Skip to content

Commit c1b7cce

Browse files
author
Alan Shaw
authored
fix: clear timeout always (storacha#166)
Prevents: ```console $ w3 login a@b.com ⁂ Agent was authorized by did:mailto:b.com:a ⠇ 🔗 please click the link sent to a@b.com to authorize this agent ```
1 parent 2b1bc4a commit c1b7cce

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

account.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const login = async (email) => loginWithClient(email, await getClient())
2121
export const loginWithClient = async (email, client) => {
2222
/** @type {import('ora').Ora|undefined} */
2323
let spinner
24-
setTimeout(() => {
24+
const timeout = setTimeout(() => {
2525
spinner = ora(
2626
`🔗 please click the link sent to ${email} to authorize this agent`
2727
).start()
@@ -38,6 +38,8 @@ export const loginWithClient = async (email, client) => {
3838
if (spinner) spinner.stop()
3939
console.error(err)
4040
process.exit(1)
41+
} finally {
42+
clearTimeout(timeout)
4143
}
4244
}
4345

0 commit comments

Comments
 (0)