@@ -152,6 +152,9 @@ export default defineComponent({
152152 showExceptionIcon () {
153153 return this .$store .state .zap .showExceptionIcon
154154 },
155+ query () {
156+ return this .$store .state .zap .query // Access the query string from Vuex
157+ },
155158 uiThemeCategory: {
156159 get () {
157160 if (this .$store .state .zap .isMultiConfig ) {
@@ -171,12 +174,9 @@ export default defineComponent({
171174 },
172175 methods: {
173176 parseQueryString () {
174- let search = window .location .search
175-
176- if (search[0 ] === ' ?' ) {
177- search = search .substring (1 )
178- }
179- this .query = querystring .parse (search)
177+ const searchParams = new URLSearchParams (window .location .search )
178+ const query = Object .fromEntries (searchParams .entries ()) // Parse query string into an object
179+ this .$store .commit (' zap/setQuery' , query) // Store it in Vuex
180180 },
181181
182182 setTheme () {
@@ -263,37 +263,28 @@ export default defineComponent({
263263 )
264264 })
265265 }
266-
267- // Parse the query string into the front end.
268- let search = window .location .search
269-
270- if (search[0 ] === ' ?' ) {
271- search = search .substring (1 )
272- }
273-
274- let query = querystring .parse (search)
275- if (query[` uiMode` ]) {
276- this .$store .dispatch (' zap/setDefaultUiMode' , query[` uiMode` ])
266+ if (this .query [` uiMode` ]) {
267+ this .$store .dispatch (' zap/setDefaultUiMode' , this .query [` uiMode` ])
277268 }
278269
279- if (` debugNavBar` in query) {
270+ if (` debugNavBar` in this . query ) {
280271 this .$store .dispatch (
281272 ' zap/setDebugNavBar' ,
282- query[` debugNavBar` ] === ' true'
273+ this . query [` debugNavBar` ] === ' true'
283274 )
284275 } else {
285276 // If we don't specify it, default is on.
286277 this .$store .dispatch (' zap/setDebugNavBar' , true )
287278 }
288279
289- if (' standalone' in query) {
290- this .$store .dispatch (' zap/setStandalone' , query[' standalone' ])
280+ if (' standalone' in this . query ) {
281+ this .$store .dispatch (' zap/setStandalone' , this . query [' standalone' ])
291282 }
292283
293- if (` setSaveButtonVisible` in query) {
284+ if (` setSaveButtonVisible` in this . query ) {
294285 this .$store .dispatch (
295286 ' zap/setSaveButtonVisible' ,
296- query[` setSaveButtonVisible` ] === ' true'
287+ this . query [` setSaveButtonVisible` ] === ' true'
297288 )
298289 } else {
299290 // If we don't specify it, default is off.
@@ -318,7 +309,7 @@ export default defineComponent({
318309
319310 // load initial UC component state
320311 this .$store .dispatch (` zap/loadUcComponentState` )
321- if (query[` newConfig` ]) {
312+ if (this . query [` newConfig` ]) {
322313 this .loadInitialEndpoints ()
323314 }
324315
0 commit comments