refactor(HomeController): add SetLanguage and GetLanguages endpoints

This commit is contained in:
2025-09-05 14:42:04 +02:00
parent 845d06fc4c
commit ada76d5030
3 changed files with 27 additions and 36 deletions

View File

@@ -26,7 +26,7 @@ function postEnvelope(annotations) {
async function setLangAsync(language, flagCode) {
document.getElementById('selectedFlag').className = 'fi ' + flagCode + ' me-2';
await fetch(`/lang/${language}`, {
await fetch(`/api/localization/lang/${language}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@@ -36,7 +36,7 @@ async function setLangAsync(language, flagCode) {
async function setLanguage(language) {
const hasLang = await fetch('/lang', {
const hasLang = await fetch('/api/localization/lang', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
@@ -47,7 +47,7 @@ async function setLanguage(language) {
.catch(err => false);
if (hasLang)
return await fetch(`/lang/${language}`, {
return await fetch(`/api/localization/lang/${language}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' }
})