Move API_ORIGIN into constants.js
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
<script setup>
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN || window.location.origin;
|
||||
|
||||
import { useI18n } from 'vue-i18n';
|
||||
const i18n = useI18n();
|
||||
const t = i18n.t;
|
||||
@@ -9,7 +7,7 @@ const t = i18n.t;
|
||||
import { ref, onMounted, useTemplateRef } from 'vue';
|
||||
import { Button, ButtonGroup, FormGroup, TextInput, Dropdown, TableView, InputDialog, Dialog } from 'pankow';
|
||||
import { prettyLongDate } from 'pankow/utils';
|
||||
import { SECRET_PLACEHOLDER } from '../constants.js';
|
||||
import { API_ORIGIN, SECRET_PLACEHOLDER } from '../constants.js';
|
||||
import Section from '../components/Section.vue';
|
||||
import PortBindings from '../components/PortBindings.vue';
|
||||
import ArchivesModel from '../models/ArchivesModel.js';
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<script>
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
import { Dialog, FormGroup, InputDialog, MultiSelect, Radiobutton, TagInput, TextInput } from 'pankow';
|
||||
|
||||
import { API_ORIGIN } from '../constants.js';
|
||||
import ApplinksModel from '../models/ApplinksModel.js';
|
||||
import UsersModel from '../models/UsersModel.js';
|
||||
import GroupsModel from '../models/GroupsModel.js';
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<script>
|
||||
|
||||
import { TextViewer, ImageViewer } from 'pankow-viewers';
|
||||
import { API_ORIGIN } from '../constants.js';
|
||||
import { createDirectoryModel } from '../models/DirectoryModel.js';
|
||||
import { sanitize } from 'pankow/utils';
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
export default {
|
||||
name: 'FileViewer',
|
||||
components: {
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
<script>
|
||||
|
||||
import { marked } from 'marked';
|
||||
|
||||
import { fetcher, Dialog, DirectoryView, TopBar, Breadcrumb, BottomBar, Button, InputDialog, MainLayout, ButtonGroup, Notification, FileUploader, Spinner } from 'pankow';
|
||||
import { sanitize, sleep } from 'pankow/utils';
|
||||
|
||||
import { ISTATES } from '../constants.js';
|
||||
|
||||
import { API_ORIGIN, ISTATES } from '../constants.js';
|
||||
import PreviewPanel from '../components/PreviewPanel.vue';
|
||||
import { createDirectoryModel } from '../models/DirectoryModel.js';
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
const BASE_URL = import.meta.env.BASE_URL || '/';
|
||||
|
||||
const beforeUnloadListener = (event) => {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<script>
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
import { marked } from 'marked';
|
||||
import { Button, PasswordInput, TextInput, fetcher } from 'pankow';
|
||||
import { API_ORIGIN } from '../constants.js';
|
||||
|
||||
export default {
|
||||
name: 'PasswordReset',
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
<script>
|
||||
|
||||
import { fetcher, Button, ButtonGroup, Dialog, FileUploader, InputDialog, MainLayout, TopBar } from 'pankow';
|
||||
|
||||
import '@xterm/xterm/css/xterm.css';
|
||||
import { Terminal } from '@xterm/xterm';
|
||||
import { AttachAddon } from '@xterm/addon-attach';
|
||||
import { FitAddon } from '@xterm/addon-fit';
|
||||
import { ISTATES, RSTATES, HSTATES } from '../constants.js';
|
||||
import { API_ORIGIN, ISTATES, RSTATES, HSTATES } from '../constants.js';
|
||||
import AppsModel from '../models/AppsModel.js';
|
||||
import { createDirectoryModel } from '../models/DirectoryModel.js';
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
export default {
|
||||
name: 'Terminal',
|
||||
components: {
|
||||
|
||||
@@ -7,7 +7,7 @@ const t = i18n.t;
|
||||
import { ref, watch, onMounted, useTemplateRef } from 'vue';
|
||||
import { Icon, Button, Switch, Checkbox, FormGroup, TextInput, TableView, ButtonGroup, Dialog } from 'pankow';
|
||||
import { prettyLongDate } from 'pankow/utils';
|
||||
import { SECRET_PLACEHOLDER } from '../../constants.js';
|
||||
import { API_ORIGIN, SECRET_PLACEHOLDER } from '../../constants.js';
|
||||
import { download } from '../../utils.js';
|
||||
import AppsModel from '../../models/AppsModel.js';
|
||||
import BackupsModel from '../../models/BackupsModel.js';
|
||||
@@ -88,9 +88,7 @@ async function onEditSubmit() {
|
||||
|
||||
function getDownloadLink(backup) {
|
||||
const accessToken = localStorage.token;
|
||||
const origin = import.meta.env.VITE_API_ORIGIN || window.location.origin;
|
||||
|
||||
return `${origin}/api/v1/apps/${props.app.id}/backups/${backup.id}/download?access_token=${accessToken}`;
|
||||
return `${API_ORIGIN}/api/v1/apps/${props.app.id}/backups/${backup.id}/download?access_token=${accessToken}`;
|
||||
}
|
||||
|
||||
async function onDownloadConfig(backup) {
|
||||
|
||||
Reference in New Issue
Block a user