1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-05 00:42:10 +03:00

tidy a bit more

This commit is contained in:
Michael Telatynski
2021-08-10 10:46:13 +01:00
parent f876c35283
commit a531446396
2 changed files with 6 additions and 7 deletions

View File

@@ -218,14 +218,13 @@ export class InteractiveAuth {
// This promise will be quite long-lived and will resolve when the
// request is authenticated and completes successfully.
this.attemptAuthDeferred = defer();
// pluck the promise out now, as doRequest may clear before we return
const promise = this.attemptAuthDeferred.promise;
const hasFlows = this.data && this.data.flows;
// if we have no flows, try a request to acquire the flows
if (!hasFlows) {
if (!this.data?.flows) {
this.busyChangedCallback?.(true);
// use the existing sessionid, if one is present.
// use the existing sessionId, if one is present.
let auth = null;
if (this.data.session) {
auth = {
@@ -412,7 +411,7 @@ export class InteractiveAuth {
this.attemptAuthDeferred = null;
} catch (error) {
// sometimes UI auth errors don't come with flows
const errorFlows = error.data ? error.data.flows : null;
const errorFlows = error.data?.flows ?? null;
const haveFlows = this.data.flows || Boolean(errorFlows);
if (error.httpStatus !== 401 || !error.data || !haveFlows) {
// doesn't look like an interactive-auth failure.