mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Add session id SessionData
This commit is contained in:
parent
9eca4566bf
commit
9b6288e49c
3 changed files with 32 additions and 5 deletions
|
|
@ -25,6 +25,13 @@ SessionData.attachSchema(
|
|||
type: String,
|
||||
optional: false,
|
||||
},
|
||||
sessionId: {
|
||||
/**
|
||||
* unique session ID
|
||||
*/
|
||||
type: String,
|
||||
optional: false,
|
||||
},
|
||||
totalHits: {
|
||||
/**
|
||||
* total number of hits in the last report query
|
||||
|
|
@ -78,4 +85,16 @@ SessionData.attachSchema(
|
|||
}),
|
||||
);
|
||||
|
||||
if (!Meteor.isServer) {
|
||||
SessionData.getSessionId = () => {
|
||||
let sessionId = Session.get('sessionId');
|
||||
if (!sessionId) {
|
||||
sessionId = `${String(Meteor.userId())}-${String(Math.random())}`;
|
||||
Session.set('sessionId', sessionId);
|
||||
}
|
||||
|
||||
return sessionId;
|
||||
};
|
||||
}
|
||||
|
||||
export default SessionData;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue