mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2025-07-10 23:33:03 -07:00
feat: support http basic auth
This commit is contained in:
parent
cd0276e598
commit
2396e973dc
2 changed files with 13 additions and 10 deletions
|
@ -13,16 +13,18 @@ function HomeLoggedOut() {
|
|||
|
||||
useEffect(() => {
|
||||
async function fetchData() {
|
||||
axios.get("/auth/login").then(function (response) {
|
||||
if (!response.data.enabled) {
|
||||
setLoggedIn(true);
|
||||
setDisableAuth(true);
|
||||
setToken("");
|
||||
history.go(0);
|
||||
} else {
|
||||
setDisableAuth(false);
|
||||
}
|
||||
});
|
||||
axios
|
||||
.get("/auth/login", { withCredentials: true })
|
||||
.then(function (response) {
|
||||
if (!response.data.enabled) {
|
||||
setLoggedIn(true);
|
||||
setDisableAuth(true);
|
||||
setToken("");
|
||||
history.go(0);
|
||||
} else {
|
||||
setDisableAuth(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
fetchData();
|
||||
}, [history, setDisableAuth, setLoggedIn, setToken]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue