Skip to content

Commit

Permalink
Merge pull request #62 from argentlabs/fix/reject-exception-connect
Browse files Browse the repository at this point in the history
fix: manage promise reject when user reject a connection in connect m…
  • Loading branch information
bluecco authored Jan 20, 2024
2 parents e447605 + f7a7c63 commit 5927c00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const connect = async ({
return target
}

return new Promise((resolve) => {
return new Promise((resolve, reject) => {
const modal = new Modal({
target: getTarget(),
props: {
Expand All @@ -150,6 +150,8 @@ export const connect = async ({
connector,
})
}
} catch (error) {
reject(error)
} finally {
setTimeout(() => modal.$destroy())
}
Expand Down
3 changes: 0 additions & 3 deletions src/modal/Modal.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script lang="ts">
import type { StarknetWindowObject } from "get-starknet-core"
import sn from "get-starknet-core"
import { onMount } from "svelte"
import ConnectorButton from "./ConnectorButton.svelte"
import type { ModalWallet } from "../types/modal"
Expand Down Expand Up @@ -29,8 +28,6 @@
setLoadingItem(connector?.id ?? false)
try {
await callback(connector ?? null)
} catch (e) {
console.error(e)
} finally {
setLoadingItem(false)
}
Expand Down

0 comments on commit 5927c00

Please sign in to comment.