diff --git a/webui/src/App.tsx b/webui/src/App.tsx index 0d72384..0b52622 100644 --- a/webui/src/App.tsx +++ b/webui/src/App.tsx @@ -6,7 +6,7 @@ import RegisterView from "./components/auth/RegisterView"; import RequireAuth from "./features/auth/RequireAuth"; import {useAppDispatch} from "./app/hooks"; import broadcastChannel from "./app/broadcastChannel"; -import {receiveAuthUpdate} from "./features/auth/authSlice"; +import {logOut, receiveAuthUpdate} from "./features/auth/authSlice"; function App() { const dispatch = useAppDispatch() @@ -23,7 +23,10 @@ function App() { } /> } /> -

hi

}/> +

hi

}/> ); } diff --git a/webui/src/layouts/AuthLayout.tsx b/webui/src/layouts/AuthLayout.tsx index 2267b57..de953ec 100644 --- a/webui/src/layouts/AuthLayout.tsx +++ b/webui/src/layouts/AuthLayout.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, {useEffect} from "react"; import styles from "./AuthLayout.module.scss"; import {Link, useLocation, useNavigate, useOutlet} from "react-router-dom"; @@ -23,12 +23,14 @@ const AuthLayout = () => { const navigate = useNavigate() - if(authState.status == "logged_in") { - if(locationState && locationState.location) { - navigate(locationState.location, {replace: true}) + useEffect(() => { + if(authState.status == "logged_in") { + if(locationState && locationState.location) { + navigate(locationState.location, {replace: true}) + } + navigate("/", {replace: true}) } - navigate("/", {replace: true}) - } + }, [authState]) return