diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 40b1c71..06a0011 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -1,7 +1,7 @@ { "name": "@cr-vif/frontend", "private": true, - "version": "0.1.0", + "version": "0.2.0", "type": "module", "scripts": { "dev": "vite", diff --git a/packages/frontend/src/contexts/AuthContext.tsx b/packages/frontend/src/contexts/AuthContext.tsx index 46e0202..307f4b1 100644 --- a/packages/frontend/src/contexts/AuthContext.tsx +++ b/packages/frontend/src/contexts/AuthContext.tsx @@ -4,6 +4,7 @@ import { useQuery } from "@tanstack/react-query"; import { api, setToken, type RouterOutputs } from "../api"; const initialAuth = safeParseLocalStorage("crvif/auth"); +if (!initialAuth) localStorage.setItem("crvif/version", "1"); setToken(initialAuth?.token); const AuthContext = createContext({ @@ -16,12 +17,12 @@ const AuthContext = createContext({ export const AuthProvider = ({ children }: PropsWithChildren) => { const [data, setData] = useState>(initialAuth); - const logout = useLogout(); - useEffect(() => { const version = localStorage.getItem("crvif/version"); if (!version) { - return logout(); + localStorage.removeItem("crvif/auth"); + localStorage.setItem("crvif/version", "1"); + window.location.reload(); } }, []);