Skip to content

Commit

Permalink
fix: Fix displaying content detail for public sites - EXO-74419 - Mee…
Browse files Browse the repository at this point in the history
  • Loading branch information
azayati authored Sep 30, 2024
1 parent 00d24f0 commit 256f9b1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ export default {
this.$refs.editor.closePluginsDrawer();
},
getAvailableLanguages() {
return this.$notesService.getAvailableLanguages().then(data => {
return this.$newsServices.getAvailableLanguages().then(data => {
this.languages = data || [];
this.languages.sort((a, b) => a.text.localeCompare(b.text));
this.allLanguages = this.languages;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default {
},
methods: {
getAvailableLanguages() {
return this.$notesService.getAvailableLanguages().then(data => {
return this.$newsServices.getAvailableLanguages().then(data => {
this.languages = data || [];
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default {
},
methods: {
getAvailableLanguages() {
return this.$notesService.getAvailableLanguages().then(data => {
return this.$newsServices.getAvailableLanguages().then(data => {
this.languages = data || [];
});
},
Expand Down
14 changes: 14 additions & 0 deletions content-webapp/src/main/webapp/vue-app/services/newsServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,20 @@ export function deleteArticleTranslation(newsId, lang) {
});
}

export function getAvailableLanguages() {
const lang = eXo?.env.portal.language || 'en';
return fetch(`${newsConstants.PORTAL}/${newsConstants.PORTAL_REST}/notes/languages?lang=${lang}`, {
method: 'GET',
credentials: 'include',
}).then(resp => {
if (!resp || !resp.ok) {
throw new Error('Response code indicates a server error', resp);
} else {
return resp.json();
}
});
}

export function getArticleLanguages(articleId, withDrafts) {
return fetch(`${newsConstants.CONTENT_API}/contents/translation/${articleId}?withDrafts=${withDrafts}`, {
credentials: 'include',
Expand Down

0 comments on commit 256f9b1

Please sign in to comment.