nidus-sync/ts/store/local.ts

17 lines
337 B
TypeScript
Raw Normal View History

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