This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kelp GUI: allow multiple users on frontend via getUserData() localsto…
…rage method (closes #686) (#690) * 1 - add logic to create and read user_id from localStorage * 2 - add uuid dependency to package.json (via npm install) * 3 - updated yarn lock file after building frontend * 4 - fix import statement of uuid
- Loading branch information
1 parent
0bc17c7
commit be0dc55
Showing
3 changed files
with
18 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
import { v4 as uuidv4 } from "uuid"; | ||
|
||
export default () => { | ||
const userIDKey = 'user_id'; | ||
|
||
let userId = localStorage.getItem(userIDKey); | ||
if (userId == null) { | ||
userId = uuidv4(); | ||
localStorage.setItem(userIDKey, userId); | ||
} | ||
|
||
return { | ||
ID: "1347129431489", | ||
ID: userId, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters