diff --git a/web/src/screens/auth/login.tsx b/web/src/screens/auth/login.tsx index 27b6af0..8bc4efc 100644 --- a/web/src/screens/auth/login.tsx +++ b/web/src/screens/auth/login.tsx @@ -7,6 +7,8 @@ import { APIClient } from "../../api/APIClient"; import { AuthContext } from "../../utils/Context"; import { PasswordInput, TextInput } from "../../components/inputs/text"; import { Tooltip } from "react-tooltip"; +import Toast from "@/components/notifications/Toast"; +import toast from "react-hot-toast"; type LoginFormFields = { username: string; @@ -22,6 +24,12 @@ export const Login = () => { const [, setAuthContext] = AuthContext.use(); useEffect(() => { + // remove user session when visiting login page' + APIClient.auth.logout() + .then(() => { + AuthContext.reset(); + }); + // Check if onboarding is available for this instance // and redirect if needed APIClient.auth.canOnboard() @@ -38,6 +46,11 @@ export const Login = () => { isLoggedIn: true }); navigate("/"); + }, + onError: () => { + toast.custom((t) => ( + + )); } } );