frontend: rework i18n and replace all superagent calls with pankow fetcher

This commit is contained in:
Johannes Zellner
2024-08-23 19:17:23 +02:00
parent 88b8cb48fc
commit 199dbff7b1
9 changed files with 75 additions and 553 deletions
+3 -5
View File
@@ -48,9 +48,7 @@
<script>
import superagent from 'superagent';
import { Button, Dialog, FileUploader, InputDialog, MainLayout, TopBar } from 'pankow';
import { fetcher, Button, Dialog, FileUploader, InputDialog, MainLayout, TopBar } from 'pankow';
import '@xterm/xterm/css/xterm.css';
import { Terminal } from '@xterm/xterm';
@@ -117,7 +115,7 @@ export default {
if (!downloadFileName) return;
try {
const result = await superagent.head(`${this.apiOrigin}/api/v1/apps/${this.id}/download`).query({
await fetcher.head(`${this.apiOrigin}/api/v1/apps/${this.id}/download`, {
file: downloadFileName,
access_token: this.accessToken
});
@@ -199,7 +197,7 @@ export default {
let execId;
try {
const result = await superagent.post(`${this.apiOrigin}/api/v1/apps/${this.id}/exec`).query({ access_token: this.accessToken }).send({ cmd: [ '/bin/bash' ], tty: true, lang: 'C.UTF-8' });
const result = await fetcher.post(`${this.apiOrigin}/api/v1/apps/${this.id}/exec`, { cmd: [ '/bin/bash' ], tty: true, lang: 'C.UTF-8' }, { access_token: this.accessToken });
execId = result.body.id;
} catch (error) {
console.error('Cannot create socket.', error);