Skip to content

Commit

Permalink
fix: clear timeout always (#166)
Browse files Browse the repository at this point in the history
Prevents:

```console
$ w3 login [email protected]
⁂ Agent was authorized by did:mailto:b.com:a
β ‡ πŸ”— please click the link sent to [email protected] to authorize this agent
```
  • Loading branch information
Alan Shaw authored Jan 23, 2024
1 parent 2b1bc4a commit c1b7cce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion account.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const login = async (email) => loginWithClient(email, await getClient())
export const loginWithClient = async (email, client) => {
/** @type {import('ora').Ora|undefined} */
let spinner
setTimeout(() => {
const timeout = setTimeout(() => {
spinner = ora(
`πŸ”— please click the link sent to ${email} to authorize this agent`
).start()
Expand All @@ -38,6 +38,8 @@ export const loginWithClient = async (email, client) => {
if (spinner) spinner.stop()
console.error(err)
process.exit(1)
} finally {
clearTimeout(timeout)
}
}

Expand Down

0 comments on commit c1b7cce

Please sign in to comment.