mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-30 18:09:40 +05:00
feat: saving auth
This commit is contained in:
parent
5aa8b1103e
commit
c4a9b4f91a
3 changed files with 67 additions and 14 deletions
|
@ -8,7 +8,7 @@ export const useUserStore = create((set, get) => ({
|
|||
token: null,
|
||||
|
||||
login: (user, token) => {
|
||||
set({ isAuth: true, user, token });
|
||||
set({ isAuth: true, user: user, token: token });
|
||||
},
|
||||
logout: () => {
|
||||
set({ isAuth: false, user: null, token: null });
|
||||
|
@ -21,7 +21,7 @@ export const useUserStore = create((set, get) => ({
|
|||
`/api/profile/${jwt.user_id}?token=${jwt.jwt}`
|
||||
);
|
||||
if (data && data.is_my_profile) {
|
||||
get().login(data, jwt.user_id, jwt.jwt);
|
||||
get().login(data.profile, jwt.jwt);
|
||||
} else {
|
||||
get().logout();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue