Skip to content

Commit

Permalink
feat: made the user data consitent
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyvid7-Darus10 committed May 21, 2023
1 parent 528d22b commit a78f1a3
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 30 deletions.
8 changes: 0 additions & 8 deletions dist/cjs/components/useUserData/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/cjs/components/useUserData/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions dist/esm/components/useUserData/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/esm/components/useUserData/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "face-guardian",
"version": "1.1.3",
"version": "1.1.4",
"description": "Face Guardian Components",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
Expand Down
9 changes: 0 additions & 9 deletions src/components/useUserData/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ const useUserData = () => {
const [userData, setUserData] = useState<any>(null);

useEffect(() => {
// Check if user data already exists in local storage
const existingUserData = localStorage.getItem('userData');
if (existingUserData) {
setUserData(JSON.parse(existingUserData));
return;
}

// Get token from local storage
const token = localStorage.getItem('token');

Expand All @@ -25,8 +18,6 @@ const useUserData = () => {
})
.then((response) => response.json())
.then((data) => {
// Save user data to local storage and state
localStorage.setItem('userData', JSON.stringify(data));
setUserData(data);
})
.catch((err) => console.error(err));
Expand Down

0 comments on commit a78f1a3

Please sign in to comment.