mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2025-07-15 09:33:13 -07:00
fix: disable authentication properly
This commit is contained in:
parent
5096a99f75
commit
75933d7e59
4 changed files with 74 additions and 65 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue