Skip to content

Commit 7fa4895

Browse files
authored
set session_uuid in one place (#1498)
* set session_uuid in one place * Revert "retrieve dirty status and send it via postMessage (#1495)" This reverts commit 5d60f45.
1 parent 5d60f45 commit 7fa4895

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

src/App.vue

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -179,19 +179,6 @@ export default defineComponent({
179179
this.query = querystring.parse(search)
180180
},
181181
182-
setSessionUuid() {
183-
if (window.sessionStorage.getItem('session_uuid') == null) {
184-
window.sessionStorage.setItem('session_uuid', uuidv4())
185-
}
186-
if (this.query[`stsApplicationId`]) {
187-
let currentSessionUuid =
188-
window.sessionStorage.getItem('session_uuid') || ''
189-
let updatedSessionUuid =
190-
this.query[`stsApplicationId`] + currentSessionUuid
191-
window.sessionStorage.setItem('session_uuid', updatedSessionUuid)
192-
}
193-
},
194-
195182
setTheme() {
196183
window[rendApi.GLOBAL_SYMBOL_EXECUTE](
197184
rendApi.id.setDarkTheme,
@@ -339,8 +326,8 @@ export default defineComponent({
339326
}
340327
)
341328
342-
this.$onWebSocket(dbEnum.wsCategory.dirtyFlag, () => {
343-
this.$store.dispatch('zap/setDirtyState')
329+
this.$onWebSocket(dbEnum.wsCategory.dirtyFlag, (resp) => {
330+
this.$store.dispatch('zap/setDirtyState', resp)
344331
})
345332
},
346333
addClassToBody() {
@@ -350,7 +337,6 @@ export default defineComponent({
350337
},
351338
created() {
352339
this.parseQueryString()
353-
this.setSessionUuid()
354340
this.setTheme()
355341
this.routePage()
356342
},

src/boot/axios.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,27 @@ import axios from 'axios'
1919
import { v4 as uuidv4 } from 'uuid'
2020
import restApi from '../../src-shared/rest-api.js'
2121
import * as Util from '../util/util.js'
22+
const querystring = require('querystring')
2223

2324
let zapUpdateExceptions = (payload, statusCode, message) => {}
2425

2526
// You can set this to false to not log all the roundtrips
2627
const log = false
2728

29+
let search = window.location.search
30+
31+
if (search[0] === '?') {
32+
search = search.substring(1)
33+
}
34+
let query = querystring.parse(search)
2835
if (window.sessionStorage.getItem('session_uuid') == null) {
2936
window.sessionStorage.setItem('session_uuid', uuidv4())
3037
}
38+
if (query[`stsApplicationId`]) {
39+
let currentSessionUuid = window.sessionStorage.getItem('session_uuid') || ''
40+
let updatedSessionUuid = query[`stsApplicationId`] + currentSessionUuid
41+
window.sessionStorage.setItem('session_uuid', updatedSessionUuid)
42+
}
3143

3244
/**
3345
* URL rewriter that can come handy in development mode.

src/store/zap/actions.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,11 +1281,10 @@ export function updateSelectedUcComponentState(context, projectInfo) {
12811281
/**
12821282
* Set the dirty state for ZAP config when there are unsaved changes.
12831283
* @param {*} context
1284+
* @param {*} isDirty
12841285
*/
1285-
export function setDirtyState(context) {
1286-
axiosRequests.$serverGet(restApi.ide.isDirty).then((resp) => {
1287-
context.commit('setDirtyState', resp.data.DIRTY)
1288-
})
1286+
export function setDirtyState(context, isDirty) {
1287+
context.commit('setDirtyState', isDirty)
12891288
}
12901289

12911290
/**

0 commit comments

Comments
 (0)