mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-30 18:09:40 +05:00
feat: add error messages to user pages
This commit is contained in:
parent
f2f03df1a0
commit
d16e4d14d4
10 changed files with 285 additions and 136 deletions
|
@ -44,14 +44,16 @@ export const useUserStore = create<userState>((set, get) => ({
|
|||
const jwt = getJWT();
|
||||
if (jwt) {
|
||||
const _checkAuth = async () => {
|
||||
const data = await fetchDataViaGet(
|
||||
const { data, error } = await fetchDataViaGet(
|
||||
`${ENDPOINTS.user.profile}/${jwt.user_id}?token=${jwt.jwt}`
|
||||
);
|
||||
if (data && data.is_my_profile) {
|
||||
get().login(data.profile, jwt.jwt);
|
||||
} else {
|
||||
|
||||
if (error || !data.is_my_profile) {
|
||||
get().logout();
|
||||
return;
|
||||
}
|
||||
|
||||
get().login(data.profile, jwt.jwt);
|
||||
};
|
||||
_checkAuth();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue