forked from Nexus/nexus
set loading when waiting for token exchange
This commit is contained in:
parent
2afd5ae258
commit
bd185824f9
1 changed files with 23 additions and 18 deletions
|
|
@ -60,27 +60,32 @@ class SelectServerPage extends HookConsumerWidget {
|
||||||
AppLinks().uriLinkStream.listen((encodedUri) async {
|
AppLinks().uriLinkStream.listen((encodedUri) async {
|
||||||
final state = encodedUri.queryParameters["state"];
|
final state = encodedUri.queryParameters["state"];
|
||||||
if (state != codeResponse.state) return;
|
if (state != codeResponse.state) return;
|
||||||
|
isLoading.value = true;
|
||||||
|
|
||||||
final code = encodedUri.queryParameters["code"];
|
try {
|
||||||
|
final code = encodedUri.queryParameters["code"];
|
||||||
|
|
||||||
if (code != null) {
|
if (code != null) {
|
||||||
await ref
|
await ref
|
||||||
.watch(ClientController.provider.notifier)
|
.watch(ClientController.provider.notifier)
|
||||||
.exchangeToken(
|
.exchangeToken(
|
||||||
.new(
|
.new(
|
||||||
homeserverUrl: newUrl,
|
homeserverUrl: newUrl,
|
||||||
codeVerifier: codeResponse.codeVerifier,
|
codeVerifier: codeResponse.codeVerifier,
|
||||||
redirectUri: .new(
|
redirectUri: .new(
|
||||||
scheme: "nexus.federated.nexus",
|
scheme: "nexus.federated.nexus",
|
||||||
path: "/",
|
path: "/",
|
||||||
|
),
|
||||||
|
code: code,
|
||||||
|
clientId: await ref.watch(
|
||||||
|
ClientIdController.provider(newUrl).future,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
code: code,
|
)
|
||||||
clientId: await ref.watch(
|
.onError(showError);
|
||||||
ClientIdController.provider(newUrl).future,
|
}
|
||||||
),
|
} finally {
|
||||||
),
|
isLoading.value = false;
|
||||||
)
|
|
||||||
.onError(showError);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue