feat: add error messages to user pages

This commit is contained in:
Kentai Radiquum 2025-03-20 22:02:49 +05:00
parent f2f03df1a0
commit d16e4d14d4
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
10 changed files with 285 additions and 136 deletions

View file

@ -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 {