Skip to content
代码片段 群组 项目
提交 912c4139 编辑于 作者: Timotej Ecimovic's avatar Timotej Ecimovic
浏览文件

Add session UUID to front-end.

上级 d7f6a3a6
No related branches found
No related tags found
无相关合并请求
无法显示 源差异:它太大了。解决此问题的选项:查看blob
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
"request": "^2.88.2", "request": "^2.88.2",
"sqlite3": "^5.0.2", "sqlite3": "^5.0.2",
"utf-8-validate": "^5.0.4", "utf-8-validate": "^5.0.4",
"uuid": "^3.3.3",
"ws": "^7.4.3", "ws": "^7.4.3",
"xml2js": "^0.4.23", "xml2js": "^0.4.23",
"xsdlibrary": "^1.3.6", "xsdlibrary": "^1.3.6",
......
...@@ -95,11 +95,6 @@ export default { ...@@ -95,11 +95,6 @@ export default {
} }
}, },
}, },
beforeCreate() {
const urlParams = new URLSearchParams(window.location.search)
let sessionId = urlParams.get(restApi.param.sessionId)
if (sessionId != null) this.$setSessionId(sessionId)
},
mounted() { mounted() {
this.$q.loading.show({ this.$q.loading.show({
spinner: QSpinnerGears, spinner: QSpinnerGears,
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
import Vue from 'vue' import Vue from 'vue'
import axios from 'axios' import axios from 'axios'
import { v4 as uuidv4 } from 'uuid'
import restApi from '../../src-shared/rest-api.js' import restApi from '../../src-shared/rest-api.js'
...@@ -24,7 +25,7 @@ Vue.prototype.$axios = axios({ withCredentials: true }) ...@@ -24,7 +25,7 @@ Vue.prototype.$axios = axios({ withCredentials: true })
// You can set this to false to not log all the roundtrips // You can set this to false to not log all the roundtrips
const log = true const log = true
let sessionId = -1 let sessionUuid = uuidv4()
/** /**
* Internal function that processes response from the server for any request. * Internal function that processes response from the server for any request.
...@@ -43,16 +44,6 @@ function processResponse(method, url, response) { ...@@ -43,16 +44,6 @@ function processResponse(method, url, response) {
return response return response
} }
/**
* Stores the session id for this browser. Session id is a key that links the
* browser with a session id inside the database.
*
* @param {*} sid
*/
function setSessionId(sid) {
sessionId = sid
}
/** /**
* This method creates a config as it should be sent to the server. * This method creates a config as it should be sent to the server.
* If passed config is null, then a new config object will be created. * If passed config is null, then a new config object will be created.
...@@ -64,13 +55,13 @@ function setSessionId(sid) { ...@@ -64,13 +55,13 @@ function setSessionId(sid) {
function fillConfig(config) { function fillConfig(config) {
if (config == null) { if (config == null) {
config = { params: {} } config = { params: {} }
config.params[restApi.param.sessionId] = sessionId config.params[restApi.param.sessionId] = sessionUuid
return config return config
} else { } else {
if (!('params' in config)) { if (!('params' in config)) {
config.params = {} config.params = {}
} }
config.params[restApi.param.sessionId] = sessionId config.params[restApi.param.sessionId] = sessionUuid
return config return config
} }
} }
...@@ -159,4 +150,3 @@ Vue.prototype.$serverPost = serverPost ...@@ -159,4 +150,3 @@ Vue.prototype.$serverPost = serverPost
Vue.prototype.$serverPut = serverPut Vue.prototype.$serverPut = serverPut
Vue.prototype.$serverPatch = serverPatch Vue.prototype.$serverPatch = serverPatch
Vue.prototype.$serverDelete = serverDelete Vue.prototype.$serverDelete = serverDelete
Vue.prototype.$setSessionId = setSessionId
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册