@devvai/devv-code-backend
Version:
Backend SDK for Devv Code - Provides authentication, data management, email and AI capabilities
37 lines (36 loc) • 1.02 kB
JavaScript
/**
* Session management for Devv Code Frontend SDK
* Handles sid storage and retrieval
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.setSid = setSid;
exports.getSid = getSid;
exports.clearSid = clearSid;
const DEVV_CODE_SID = 'DEVV_CODE_SID';
/**
* Store session ID in localStorage
*/
function setSid(sid) {
if (typeof globalThis !== 'undefined' && typeof globalThis.localStorage !== 'undefined') {
localStorage.setItem(DEVV_CODE_SID, sid);
}
}
/**
* Get session ID from localStorage
* Returns null if not found or not in browser environment
*/
function getSid() {
if (typeof globalThis !== 'undefined' && typeof globalThis.localStorage !== 'undefined') {
return localStorage.getItem(DEVV_CODE_SID);
}
return null;
}
/**
* Clear session ID from localStorage
*/
function clearSid() {
if (typeof globalThis !== 'undefined' && typeof globalThis.localStorage !== 'undefined') {
localStorage.removeItem(DEVV_CODE_SID);
}
}
;