nidus-sync/ts/store/local.ts

17 lines
339 B
TypeScript
Raw Normal View History

2026-04-09 23:38:20 +00:00
import { defineStore } from "pinia";
export const useStoreLocal = defineStore("local", () => {
function getSessionID(): string {
let id = localStorage.getItem("session_id");
if (id) {
return id;
}
id = crypto.randomUUID();
localStorage.setItem("session_id", id.toString());
return id;
}
return {
getSessionID,
};
});