Skip to content

Commit

Permalink
Manage case without anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
lmuntaner committed Apr 9, 2024
1 parent 8ce57d6 commit 1306c9a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/frontend/src/flows/verifiableCredentials/allowCredentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ const allowCredentialsTemplate = ({
onSubmit: (userNumber) => onAllow(userNumber),
});

const presentCredential = () => {
if (userNumber === undefined) {
anchorInput.submit();
return;
}
onAllow(userNumber);
};

const knownDapps = getDapps();
const consentMessage = new Chan<TemplateElement>(html`${consentMessage_}`);

Expand Down Expand Up @@ -105,6 +113,8 @@ const allowCredentialsTemplate = ({
</div>
</div>
${userNumber === undefined ? anchorInput.template : ""}
<div class="c-separator l-stack">
<div class="c-separator__dot--tiny"></div>
<div class="c-separator__dot--small"></div>
Expand Down Expand Up @@ -137,7 +147,7 @@ const allowCredentialsTemplate = ({
<button
data-action="allow"
class="c-button"
@click="${() => anchorInput.submit()}"
@click="${presentCredential}"
>
${copy.allow}
</button>
Expand Down
1 change: 1 addition & 0 deletions src/showcase/src/pages/allowCredentials.astro
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Screen from "../layouts/Screen.astro";
i18n,
relyingOrigin: "https://oc.app",
providerOrigin: "https://nns.ic0.app",
userNumber: 123456n,
consentMessage: "Lives in Switzerland",
onAllow: () => toast.info(html`Allowed`),
onCancel: () => toast.info(html`Canceled`),
Expand Down

0 comments on commit 1306c9a

Please sign in to comment.