Skip to content

Commit

Permalink
fix(use-user): set user to null instead of {}
Browse files Browse the repository at this point in the history
  • Loading branch information
aprendendofelipe committed Dec 29, 2022
1 parent e6cee94 commit e724c3c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pages/interface/hooks/useUser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function UserProvider({ children }) {

function onFocus() {
const cachedUser = JSON.parse(localStorage.getItem('user'));
setUser((user) => ({ ...user, ...cachedUser }));
setUser((user) => (cachedUser?.username ? { ...user, ...cachedUser } : null));
if (refreshInterval < Date.now() - cachedUser?.cacheTime) fetchUser();
}
addEventListener('focus', onFocus);
Expand Down

0 comments on commit e724c3c

Please sign in to comment.