move isLoggedIn logic to auth context
This commit is contained in:
@@ -162,12 +162,6 @@ export class UmbAppElement extends UmbLitElement {
|
||||
OpenAPI.TOKEN = () => this.#authContext!.getLatestToken();
|
||||
OpenAPI.WITH_CREDENTIALS = true;
|
||||
}
|
||||
|
||||
if (this.#authContext?.isAuthorized()) {
|
||||
this.#authContext?.setLoggedIn(true);
|
||||
} else {
|
||||
this.#authContext?.setLoggedIn(false);
|
||||
}
|
||||
}
|
||||
|
||||
#redirect() {
|
||||
|
||||
@@ -32,7 +32,14 @@ export class UmbAuthContext extends UmbBaseController implements IUmbAuth {
|
||||
}
|
||||
|
||||
isAuthorized() {
|
||||
return this.isBypassed ? true : this.#authFlow.isAuthorized();
|
||||
if (this.isBypassed) {
|
||||
this.#isLoggedIn.next(true);
|
||||
return true;
|
||||
} else {
|
||||
const isAuthorized = this.#authFlow.isAuthorized();
|
||||
this.#isLoggedIn.next(isAuthorized);
|
||||
return isAuthorized;
|
||||
}
|
||||
}
|
||||
|
||||
setInitialState(): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user