frontend: replace more superagent with pankow fetcher

This commit is contained in:
Johannes Zellner
2024-08-23 18:12:17 +02:00
parent 5de7537c71
commit e8b3232966
2 changed files with 17 additions and 20 deletions
+4 -6
View File
@@ -5,10 +5,10 @@ import './style.css';
import '@fontsource/noto-sans';
import superagent from 'superagent';
import { createRouter, createWebHashHistory } from 'vue-router';
import { fetcher } from 'pankow';
import FileManager from './FileManager.vue';
import Home from './views/Home.vue';
import Viewer from './views/Viewer.vue';
@@ -47,10 +47,8 @@ const i18n = createI18n({
async function loadLanguage(lang) {
try {
const result = await superagent.get(`${API_ORIGIN}/translation/${lang}.json`);
// we do not deliver as application/json :/
translations[lang] = JSON.parse(result.text);
const result = await fetcher.get(`${API_ORIGIN}/translation/${lang}.json`);
translations[lang] = result.body;
} catch (e) {
console.error(`Failed to load language file for ${lang}`, e);
}