frontend: ensure API_ORIGIN is always set

This commit is contained in:
Johannes Zellner
2024-08-23 19:28:26 +02:00
parent 199dbff7b1
commit 9f89b07777
5 changed files with 19 additions and 22 deletions
+3 -4
View File
@@ -31,7 +31,7 @@ import { Button, TopBar, MainLayout } from 'pankow';
import LogsModel from '../models/LogsModel.js';
import AppModel from '../models/AppModel.js';
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? 'https://' + import.meta.env.VITE_API_ORIGIN : window.location.origin ;
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? 'https://' + import.meta.env.VITE_API_ORIGIN : window.location.origin;
export default {
name: 'LogsViewer',
@@ -43,7 +43,6 @@ export default {
data() {
return {
accessToken: localStorage.token,
apiOrigin: API_ORIGIN || '',
logsModel: null,
appModel: null,
busyRestart: false,
@@ -113,10 +112,10 @@ export default {
return;
}
this.logsModel = LogsModel.create(this.apiOrigin, this.accessToken, this.type, this.id);
this.logsModel = LogsModel.create(API_ORIGIN, this.accessToken, this.type, this.id);
if (this.type === 'app') {
this.appModel = AppModel.create(this.apiOrigin, this.accessToken, this.id);
this.appModel = AppModel.create(API_ORIGIN, this.accessToken, this.id);
try {
const app = await this.appModel.get();