fix: Race condition on login

This commit is contained in:
Tom Moor
2023-07-17 19:06:31 -04:00
parent 4b14fa5dd7
commit 64b2718673
2 changed files with 12 additions and 0 deletions

View File

@@ -81,6 +81,9 @@ export default class AuthStore {
@observable
isSaving = false;
@observable
isFetching = true;
/* Whether the user is currently suspended. */
@observable
isSuspended = false;
@@ -178,6 +181,8 @@ export default class AuthStore {
@action
fetch = async () => {
this.isFetching = true;
try {
const res = await client.post("/auth.info", undefined, {
credentials: "same-origin",
@@ -234,6 +239,8 @@ export default class AuthStore {
this.isSuspended = true;
this.suspendedContactEmail = err.data.adminEmail;
}
} finally {
this.isFetching = false;
}
};