web: add firebase push token registration and sync
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { create } from "zustand";
|
||||
import { loginRequest, meRequest, refreshRequest } from "../api/auth";
|
||||
import type { AuthUser } from "../chat/types";
|
||||
import { unregisterWebPushToken } from "../utils/firebasePush";
|
||||
import { useChatStore } from "./chatStore";
|
||||
|
||||
interface AuthState {
|
||||
@@ -59,6 +60,7 @@ export const useAuthStore = create<AuthState>((set, get) => ({
|
||||
get().setTokens(data.access_token, data.refresh_token);
|
||||
},
|
||||
logout: () => {
|
||||
void unregisterWebPushToken();
|
||||
localStorage.removeItem(ACCESS_KEY);
|
||||
localStorage.removeItem(REFRESH_KEY);
|
||||
useChatStore.getState().reset();
|
||||
|
||||
Reference in New Issue
Block a user