mirror of
https://github.com/donaldzou/WGDashboard
synced 2025-02-26 05:58:47 +00:00
Fixed hardcoded issue
This commit is contained in:
parent
5cd99f2edc
commit
ac77c3a390
@ -31,6 +31,7 @@ Chart.register(
|
|||||||
import LocaleText from "@/components/text/localeText.vue";
|
import LocaleText from "@/components/text/localeText.vue";
|
||||||
import {DashboardConfigurationStore} from "@/stores/DashboardConfigurationStore.js";
|
import {DashboardConfigurationStore} from "@/stores/DashboardConfigurationStore.js";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
import {useRoute, useRouter} from "vue-router";
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
configurationPeers: Array,
|
configurationPeers: Array,
|
||||||
configurationInfo: Object
|
configurationInfo: Object
|
||||||
@ -45,12 +46,12 @@ const historyReceivedData = ref({
|
|||||||
timestamp: [],
|
timestamp: [],
|
||||||
data: []
|
data: []
|
||||||
})
|
})
|
||||||
|
const route = useRoute()
|
||||||
const dashboardStore = DashboardConfigurationStore()
|
const dashboardStore = DashboardConfigurationStore()
|
||||||
const fetchRealtimeTrafficInterval = ref(undefined)
|
const fetchRealtimeTrafficInterval = ref(undefined)
|
||||||
const fetchRealtimeTraffic = async () => {
|
const fetchRealtimeTraffic = async () => {
|
||||||
await fetchGet("/api/getWireguardConfigurationRealtimeTraffic", {
|
await fetchGet("/api/getWireguardConfigurationRealtimeTraffic", {
|
||||||
configurationName: "wg1"
|
configurationName: route.params.id
|
||||||
}, (res) => {
|
}, (res) => {
|
||||||
let timestamp = dayjs().format("hh:mm:ss A")
|
let timestamp = dayjs().format("hh:mm:ss A")
|
||||||
|
|
||||||
|
@ -19,9 +19,6 @@ const getUrl = (url) => {
|
|||||||
if (apiKey){
|
if (apiKey){
|
||||||
return `${apiKey.host}${url}`
|
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
|
return import.meta.env.MODE === 'development' ? url
|
||||||
: `${window.location.protocol}//${(window.location.host + window.location.pathname + url).replace(/\/\//g, '/')}`
|
: `${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.ok){
|
||||||
if (x.status !== 200){
|
if (x.status !== 200){
|
||||||
if (x.status === 401){
|
if (x.status === 401){
|
||||||
|
|
||||||
store.newMessage("WGDashboard", "Sign in session ended, please sign in again", "warning")
|
store.newMessage("WGDashboard", "Sign in session ended, please sign in again", "warning")
|
||||||
}
|
}
|
||||||
throw new Error(x.statusText)
|
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 => {
|
}).then(x => callback ? callback(x) : undefined).catch(x => {
|
||||||
console.log(x)
|
console.log(x)
|
||||||
router.push({path: '/signin'})
|
router.push({path: '/signin'})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user