Assign user to userStore

This commit is contained in:
Brian Cao 2022-11-09 13:54:09 -08:00
parent 84375a582e
commit 7bf12cc552
2 changed files with 9 additions and 4 deletions

View file

@ -12,14 +12,17 @@ export default function useRequireLogin() {
async function loadUser() {
setLoading(true);
const { ok, data } = await get('/auth/verify');
const {
ok,
data: { user },
} = await get('/auth/verify');
if (!ok) {
await router.push('/login');
return null;
}
setUser(data);
setUser(user);
setLoading(false);
}