fix: disable authentication properly

This commit is contained in:
Sambhav Saggi 2022-05-31 18:29:50 -04:00
parent 5096a99f75
commit 75933d7e59
No known key found for this signature in database
GPG key ID: 8F731DA8AFBAE35D
4 changed files with 74 additions and 65 deletions

View file

@ -6,10 +6,12 @@ import { useHistory } from "react-router-dom";
function HomeLoggedOut() {
const [, setLoggedIn] = useLocalStorage("loggedIn", false);
const [, setToken] = useLocalStorage("token", null);
const [, setDisableAuth] = useLocalStorage("disableAuth", false);
const history = useHistory();
axios.get("/auth/login").then(function (response) {
if (!response.data.enabled) {
setLoggedIn(true);
setDisableAuth(true);
setToken("");
history.go(0);
}