MCPcopy Index your code
hub / github.com/caesarHQ/textSQL / getUserId

Function getUserId

client/censusGPT/src/utils/user.js:3–16  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import { v4 as uuidv4 } from 'uuid';
2
3export const getUserId = () => {
4 const localStorageKey = 'census_user_id';
5 let userId = localStorage.getItem(localStorageKey);
6
7 if (!userId) {
8 // Generate a unique ID for the user
9 userId = `${uuidv4()}_${new Date().getTime()}`;
10
11 // Save the user ID in local storage
12 localStorage.setItem(localStorageKey, userId);
13 }
14
15 return userId;
16}

Callers 1

App.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected