mirror of
https://github.com/mudabbir-ahmad/MAD-Treasure-Hunt.git
synced 2026-10-07 19:00:20 +00:00
31 lines
679 B
JavaScript
31 lines
679 B
JavaScript
const session = {
|
|
currentUid: null,
|
|
currentGid: null,
|
|
currentSGid: null,
|
|
currentTGid: null,
|
|
};
|
|
|
|
const setSessionUser = (user) => {
|
|
session.currentUid = user?.Uid ?? null;
|
|
session.currentGid = user?.Gid ?? null;
|
|
session.currentSGid = user?.SGid ?? null;
|
|
session.currentTGid = user?.TGid ?? null;
|
|
};
|
|
|
|
const setSessionGroup = (gid, sgid = null) => {
|
|
session.currentGid = gid ?? null;
|
|
if (sgid !== null && sgid !== undefined) {
|
|
session.currentSGid = sgid;
|
|
}
|
|
};
|
|
|
|
const setSessionTeam = (tgid) => {
|
|
session.currentTGid = tgid ?? null;
|
|
};
|
|
|
|
const getSession = () => ({ ...session });
|
|
|
|
export { setSessionUser, setSessionGroup, setSessionTeam, getSession };
|
|
|
|
|