Skip to content

Commit

Permalink
set session_uuid in one place (#1498)
Browse files Browse the repository at this point in the history
* set session_uuid in one place

* Revert "retrieve dirty status and send it via postMessage (#1495)"

This reverts commit 5d60f45.
  • Loading branch information
paulr34 authored Dec 13, 2024
1 parent 5d60f45 commit 7fa4895
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
18 changes: 2 additions & 16 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,19 +179,6 @@ export default defineComponent({
this.query = querystring.parse(search)
},

setSessionUuid() {
if (window.sessionStorage.getItem('session_uuid') == null) {
window.sessionStorage.setItem('session_uuid', uuidv4())
}
if (this.query[`stsApplicationId`]) {
let currentSessionUuid =
window.sessionStorage.getItem('session_uuid') || ''
let updatedSessionUuid =
this.query[`stsApplicationId`] + currentSessionUuid
window.sessionStorage.setItem('session_uuid', updatedSessionUuid)
}
},

setTheme() {
window[rendApi.GLOBAL_SYMBOL_EXECUTE](
rendApi.id.setDarkTheme,
Expand Down Expand Up @@ -339,8 +326,8 @@ export default defineComponent({
}
)

this.$onWebSocket(dbEnum.wsCategory.dirtyFlag, () => {
this.$store.dispatch('zap/setDirtyState')
this.$onWebSocket(dbEnum.wsCategory.dirtyFlag, (resp) => {
this.$store.dispatch('zap/setDirtyState', resp)
})
},
addClassToBody() {
Expand All @@ -350,7 +337,6 @@ export default defineComponent({
},
created() {
this.parseQueryString()
this.setSessionUuid()
this.setTheme()
this.routePage()
},
Expand Down
12 changes: 12 additions & 0 deletions src/boot/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,27 @@ import axios from 'axios'
import { v4 as uuidv4 } from 'uuid'
import restApi from '../../src-shared/rest-api.js'
import * as Util from '../util/util.js'
const querystring = require('querystring')

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

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

let search = window.location.search

if (search[0] === '?') {
search = search.substring(1)
}
let query = querystring.parse(search)
if (window.sessionStorage.getItem('session_uuid') == null) {
window.sessionStorage.setItem('session_uuid', uuidv4())
}
if (query[`stsApplicationId`]) {
let currentSessionUuid = window.sessionStorage.getItem('session_uuid') || ''
let updatedSessionUuid = query[`stsApplicationId`] + currentSessionUuid
window.sessionStorage.setItem('session_uuid', updatedSessionUuid)
}

/**
* URL rewriter that can come handy in development mode.
Expand Down
7 changes: 3 additions & 4 deletions src/store/zap/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1281,11 +1281,10 @@ export function updateSelectedUcComponentState(context, projectInfo) {
/**
* Set the dirty state for ZAP config when there are unsaved changes.
* @param {*} context
* @param {*} isDirty
*/
export function setDirtyState(context) {
axiosRequests.$serverGet(restApi.ide.isDirty).then((resp) => {
context.commit('setDirtyState', resp.data.DIRTY)
})
export function setDirtyState(context, isDirty) {
context.commit('setDirtyState', isDirty)
}

/**
Expand Down

0 comments on commit 7fa4895

Please sign in to comment.