Skip to content

Commit

Permalink
fix: call onLogout & redirect only after logout returns
Browse files Browse the repository at this point in the history
  • Loading branch information
kldavis4 committed Nov 8, 2023
1 parent b92ce85 commit f8efce4
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,15 @@ export function UpdatePassword(props: {}) {
setPasswordChangeRequired(false)
// sleep for 1 second to allow the user to see the success message
await new Promise((resolve) => setTimeout(resolve, 1000))
client?.authProvider?.logout().catch((e) => console.error(e))
window.location.href = new URL(window.location.href).pathname
client?.authProvider
?.logout()
.then(async () => {
if (typeof client?.onLogout === 'function') {
await client.onLogout()
}
window.location.href = new URL(window.location.href).pathname
})
.catch((e) => console.error(e))
}
setFormState('idle')
}
Expand Down

0 comments on commit f8efce4

Please sign in to comment.