Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Throw exception if no login flows found
Browse files Browse the repository at this point in the history
  • Loading branch information
pinusc committed Jan 21, 2024
1 parent a475600 commit 6e535f4
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/LoginHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,24 @@ export default class LoginHandler {
base_url = "https://" + name;
} finally {
this.base_url = base_url;
try {
shared.mClient = createClient({
baseUrl: base_url,
fetchFn: customFetch,
});
let result = await shared.mClient.loginFlows()
if (! result.flows) {
throw new Error("Got no flows");
}
this.loginFlows = result.flows;
} catch (e) {
alert(`No server found at ${base_url}`)
console.log(e);
}
this.setWellKnown({
"m.homeserver": {"base_url": base_url},
"m.identity_server": {"base_url": "https://vector.im"}, // TODO Where to infer this outside of actual .well-known?
})
shared.mClient = createClient({
baseUrl: base_url,
fetchFn: customFetch,
});
let result = await shared.mClient.loginFlows()
this.loginFlows = result.flows;
}
}
}

0 comments on commit 6e535f4

Please sign in to comment.