mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-10 04:47:53 +00:00
Changed how the UI processes /auth to turn on/off authentication
This commit is contained in:
parent
d7ba3c8334
commit
9086587e06
1 changed files with 16 additions and 16 deletions
|
|
@ -56,26 +56,26 @@ function useProvideAuth() {
|
|||
pilosa.get
|
||||
.auth()
|
||||
.then((res) => {
|
||||
// User is authenticated
|
||||
if (res.data === "OK") {
|
||||
setAuthOn(true);
|
||||
setIsAuthenticated(true);
|
||||
|
||||
// get userinfo
|
||||
userinfo();
|
||||
}
|
||||
// Auth is off
|
||||
else if (
|
||||
if (res.status === 204) {
|
||||
// Authentication is off
|
||||
res.data.startsWith(
|
||||
"Trying to authenticate but authentication is off"
|
||||
)
|
||||
) {
|
||||
);
|
||||
setAuthOn(false);
|
||||
}
|
||||
// User not authenticated
|
||||
else {
|
||||
} else {
|
||||
// Turn on Authentication
|
||||
setAuthOn(true);
|
||||
setIsAuthenticated(false);
|
||||
|
||||
if (res.data === "OK") {
|
||||
// User is authenticated
|
||||
setIsAuthenticated(true);
|
||||
|
||||
// get userinfo
|
||||
userinfo();
|
||||
} else {
|
||||
// User not authenticated
|
||||
setIsAuthenticated(false);
|
||||
}
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue