|
|
@ -52,16 +52,8 @@ const createAuthStore = () => { |
|
|
|
|
|
|
|
|
// Or fetch the current user from localstorage in a real app
|
|
|
// Or fetch the current user from localstorage in a real app
|
|
|
else { |
|
|
else { |
|
|
if (get(store) == null) { |
|
|
const user = await API.fetchSelf() |
|
|
const user = await API.fetchSelf() |
|
|
store.set(user) |
|
|
if (user) { |
|
|
|
|
|
store.set(user) |
|
|
|
|
|
} else { |
|
|
|
|
|
await logOut() |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
await logOut() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|