diff --git a/src/hooks/use-user.js b/src/hooks/use-user.js index 0264307..cb29470 100644 --- a/src/hooks/use-user.js +++ b/src/hooks/use-user.js @@ -7,6 +7,10 @@ import useSWRImmutable from "swr/immutable"; const useUser = () => { const { token } = useContext(AuthContext); + useEffect(() => { + mutate(); + }, [token]); + const { data, error, isLoading, mutate } = useSWR( token ? "/auth/users/me" : null, getAuthFetcher(token),