-
Notifications
You must be signed in to change notification settings - Fork 79
Description
Hi, thanks for the time you take to make this a public module for others to use. I was happy to find it and it's working pretty good so far.
When my app launches, I'd like to see if the user is logged in via verifyCredentials. I want to wait until verifyCredentials returns before redirecting the user to their logged-in page. I don't know TypeScript well, but it looks like the TS method signature of verifyCredentials means the method will return a Promise...
const verifyCredentials = async (store: Store<{}>): Promise<void> => {
//...
}I'd like my code to do this:
verifyCredentials(store)
.then(() => {
// check state to see if the user is now logged in
// redirect the user
})It seems like verifyCredentials only ever returns undefined. The method functionality doesn't return a new Promise, but the method signature implies a Promise.
How can I know that verifyCredentials is finished?
The workarounds I can think of are:
- Catch the login in a reducer, fire an action from a reducer, which is an anti-pattern.
- Implement my own customVerifyCredentials that does similar logic to verifyCredentials but returns a promise (and maybe the status of the API call).
Thanks for any input you can offer.