Fixed hardcoded issue

This commit is contained in:
Donald Zou 2025-02-15 16:49:49 +08:00
parent 5cd99f2edc
commit ac77c3a390
2 changed files with 4 additions and 7 deletions

View File

@ -31,6 +31,7 @@ Chart.register(
import LocaleText from "@/components/text/localeText.vue";
import {DashboardConfigurationStore} from "@/stores/DashboardConfigurationStore.js";
import dayjs from "dayjs";
import {useRoute, useRouter} from "vue-router";
const props = defineProps({
configurationPeers: Array,
configurationInfo: Object
@ -45,12 +46,12 @@ const historyReceivedData = ref({
timestamp: [],
data: []
})
const route = useRoute()
const dashboardStore = DashboardConfigurationStore()
const fetchRealtimeTrafficInterval = ref(undefined)
const fetchRealtimeTraffic = async () => {
await fetchGet("/api/getWireguardConfigurationRealtimeTraffic", {
configurationName: "wg1"
configurationName: route.params.id
}, (res) => {
let timestamp = dayjs().format("hh:mm:ss A")

View File

@ -19,9 +19,6 @@ const getUrl = (url) => {
if (apiKey){
return `${apiKey.host}${url}`
}
// console.log("URL fetching: ", import.meta.env.MODE === 'development' ? url
// : `${window.location.protocol}//${(window.location.host + window.location.pathname + url).replace(/\/\//g, '/')}`)
return import.meta.env.MODE === 'development' ? url
: `${window.location.protocol}//${(window.location.host + window.location.pathname + url).replace(/\/\//g, '/')}`
}
@ -36,7 +33,6 @@ export const fetchGet = async (url, params=undefined, callback=undefined) => {
if (!x.ok){
if (x.status !== 200){
if (x.status === 401){
store.newMessage("WGDashboard", "Sign in session ended, please sign in again", "warning")
}
throw new Error(x.statusText)
@ -46,7 +42,7 @@ export const fetchGet = async (url, params=undefined, callback=undefined) => {
}
}).then(x => callback ? callback(x) : undefined).catch(x => {
console.log(x)
router.push({path: '/signin'})
router.push({path: '/signin'})
})
}