This commit is contained in:
eric
2026-03-10 07:13:36 -05:00
parent 585be56314
commit a1696c2d0b
2 changed files with 20 additions and 1 deletions

View File

@@ -84,6 +84,17 @@ export default function Home() {
const getOrCreateUserId = useCallback(() => {
let userId = getStorage("userId");
if (userId?.startsWith("{") && userId.includes("data")) {
try {
const parsed = JSON.parse(userId) as { data?: string };
if (parsed?.data) {
userId = parsed.data;
setStorage("userId", userId);
}
} catch {
userId = null;
}
}
if (!userId) {
userId = `user${Date.now()}`;
setStorage("userId", userId);