) : null}
- You can try resetting the page page using the button provided below.
+ You can try resetting the page state using the button provided below.
However, this is not guaranteed to fix the error.
);
-};
\ No newline at end of file
+};
diff --git a/web/src/screens/auth/login.tsx b/web/src/screens/auth/login.tsx
index e594c1c..88e1030 100644
--- a/web/src/screens/auth/login.tsx
+++ b/web/src/screens/auth/login.tsx
@@ -8,7 +8,7 @@ import { APIClient } from "../../api/APIClient";
import { AuthContext } from "../../utils/Context";
import { PasswordInput, TextInput } from "../../components/inputs/text";
-export type LoginFormFields = {
+type LoginFormFields = {
username: string;
password: string;
};
diff --git a/web/src/screens/auth/logout.tsx b/web/src/screens/auth/logout.tsx
index 242246b..8ba76aa 100644
--- a/web/src/screens/auth/logout.tsx
+++ b/web/src/screens/auth/logout.tsx
@@ -1,19 +1,25 @@
import { useEffect } from "react";
+import { useNavigate } from "react-router-dom";
import toast from "react-hot-toast";
import { APIClient } from "../../api/APIClient";
-import Toast from "../../components/notifications/Toast";
import { AuthContext } from "../../utils/Context";
+import Toast from "../../components/notifications/Toast";
export const Logout = () => {
+ const navigate = useNavigate();
useEffect(
() => {
APIClient.auth.logout()
.then(() => {
+ AuthContext.reset();
toast.custom((t) => (
));
- AuthContext.reset();
+
+ // Dirty way to fix URL without triggering a re-render.
+ // Ideally, we'd move the logout component to a function.
+ setInterval(() => navigate("/", { replace: true }), 250);
});
},
[]