Skip to content

Commit 4f34440

Browse files
committed
Refactor code to use native method
1 parent e6af295 commit 4f34440

File tree

3 files changed

+6
-34
lines changed

3 files changed

+6
-34
lines changed

src/Frontend/src/stores/MonitoringStore.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import type { EndpointGroup, Endpoint, GroupedEndpoint } from "@/resources/Monit
66
import type { SortInfo } from "@/components/SortInfo";
77
import useConnectionsAndStatsAutoRefresh from "@/composables/useConnectionsAndStatsAutoRefresh";
88
import GroupOperation from "@/resources/GroupOperation";
9-
import { getParameter, getParams } from "./environment";
109
import { useServiceControlStore } from "./ServiceControlStore";
1110

1211
export const useMonitoringStore = defineStore("MonitoringStore", () => {
@@ -54,11 +53,11 @@ export const useMonitoringStore = defineStore("MonitoringStore", () => {
5453
}
5554

5655
function refresh() {
57-
const params = getParams();
58-
const mu = getParameter(params, "mu");
56+
const searchParams = new URLSearchParams(window.location.search);
57+
const mu = searchParams.get("mu");
5958

6059
if (mu) {
61-
monitoringUrl.value = mu.value;
60+
monitoringUrl.value = mu;
6261
window.localStorage.setItem("mu", monitoringUrl.value);
6362
console.debug(`Monitoring Url found in QS and stored in local storage: ${monitoringUrl.value}`);
6463
} else if (window.localStorage.getItem("mu")) {

src/Frontend/src/stores/ServiceControlStore.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { acceptHMRUpdate, defineStore } from "pinia";
22
import { ref } from "vue";
3-
import { getParameter, getParams } from "./environment";
43

54
export const useServiceControlStore = defineStore("ServiceControlStore", () => {
65
const serviceControlUrl = ref<string | null>();
@@ -16,11 +15,11 @@ export const useServiceControlStore = defineStore("ServiceControlStore", () => {
1615
}
1716

1817
function refresh() {
19-
const params = getParams();
20-
const scu = getParameter(params, "scu");
18+
const searchParams = new URLSearchParams(window.location.search);
19+
const scu = searchParams.get("scu");
2120

2221
if (scu) {
23-
serviceControlUrl.value = scu.value;
22+
serviceControlUrl.value = scu;
2423
window.localStorage.setItem("scu", serviceControlUrl.value);
2524
console.debug(`ServiceControl Url found in QS and stored in local storage: ${serviceControlUrl.value}`);
2625
} else if (window.localStorage.getItem("scu")) {

src/Frontend/src/stores/environment.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)