diff --git a/src/static/app/src/components/configurationComponents/peerListComponents/peerDataUsageCharts.vue b/src/static/app/src/components/configurationComponents/peerListComponents/peerDataUsageCharts.vue index 49e2bb4..b8b1e0d 100644 --- a/src/static/app/src/components/configurationComponents/peerListComponents/peerDataUsageCharts.vue +++ b/src/static/app/src/components/configurationComponents/peerListComponents/peerDataUsageCharts.vue @@ -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") diff --git a/src/static/app/src/utilities/fetch.js b/src/static/app/src/utilities/fetch.js index 616843c..b77ec5e 100644 --- a/src/static/app/src/utilities/fetch.js +++ b/src/static/app/src/utilities/fetch.js @@ -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'}) }) }