Skip to content

Commit

Permalink
Add loader when fetching delegation (#2245)
Browse files Browse the repository at this point in the history
A recent refactor of the postMessage interface left out a loader during
a slow operation (fetching the delegation). This re-introduces a loader.
  • Loading branch information
nmattia authored Jan 30, 2024
1 parent 88ec50b commit 1c39498
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/frontend/src/flows/authorize/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
} from "$src/components/authenticateBox";
import { displayError } from "$src/components/displayError";
import { caretDownIcon } from "$src/components/icons";
import { withLoader } from "$src/components/loader";
import { showMessage } from "$src/components/message";
import { showSpinner } from "$src/components/spinner";
import { getDapps } from "$src/flows/dappsExplorer/dapps";
Expand Down Expand Up @@ -206,12 +207,14 @@ const authenticate = async (
const derivationOrigin =
authContext.authRequest.derivationOrigin ?? authContext.requestOrigin;

const result = await fetchDelegation({
connection: authSuccess.connection,
derivationOrigin,
publicKey: authContext.authRequest.sessionPublicKey,
maxTimeToLive: authContext.authRequest.maxTimeToLive,
});
const result = await withLoader(() =>
fetchDelegation({
connection: authSuccess.connection,
derivationOrigin,
publicKey: authContext.authRequest.sessionPublicKey,
maxTimeToLive: authContext.authRequest.maxTimeToLive,
})
);

if ("error" in result) {
return {
Expand Down

0 comments on commit 1c39498

Please sign in to comment.