Skip to content

Commit

Permalink
Remove unnecessary assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
nmattia committed Nov 30, 2023
1 parent bf36c3a commit 1e426c5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions demos/test-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ const customMessageBtn = document.getElementById(
) as HTMLButtonElement;
const messagesEl = document.getElementById("messages") as HTMLElement;
const hostUrlEl = document.getElementById("hostUrl") as HTMLInputElement;
const whoAmIResponseEl = document.getElementById("whoamiResponse");
const whoAmIResponseEl = document.getElementById(
"whoamiResponse"
) as HTMLDivElement;
const alternativeOriginsEl = document.getElementById(
"alternativeOrigins"
) as HTMLDivElement;
Expand Down Expand Up @@ -300,7 +302,7 @@ const init = async () => {

init();

whoamiBtn!.addEventListener("click", async () => {
whoamiBtn.addEventListener("click", async () => {
const identity = await authClient.getIdentity();
const canisterId = Principal.fromText(readCanisterId());
const actor = Actor.createActor(idlFactory, {
Expand All @@ -311,13 +313,13 @@ whoamiBtn!.addEventListener("click", async () => {
canisterId,
});

whoAmIResponseEl!.innerText = "Loading...";
whoAmIResponseEl.innerText = "Loading...";

// Similar to the sample project on dfx new:
actor
.whoami()
.then((principal: any) => {
whoAmIResponseEl!.innerText = principal.toText();
whoAmIResponseEl.innerText = principal.toText();
})
.catch((err) => {
console.error("Failed to fetch whoami", err);
Expand Down

0 comments on commit 1e426c5

Please sign in to comment.