Skip to content

Merge pull request #30 from ljosberinn/master #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 15, 2020
Merged

Merge pull request #30 from ljosberinn/master #30

merged 10 commits into from
Jan 15, 2020

Conversation

ljosberinn
Copy link
Contributor

Hi,

this is in regard of #28 but also went above and beyond..

  • was able to bumb devDependency versions of everything to latest (optional chaining 🎉)
  • all functions where it makes sense now use useCallback (which led to plenty of useEffect bugs due to re-creation when I used it)
  • runRoutes should be more lightweight
  • runRoutes returns the promised TokenParam, but only for tokens that aren't automatically taken care of anyways
  • TokenParam can situationally include error & status for errorRoute
  • just general low hanging fruits like the provider type

There is a token type for email_change, however there is no such function. I assume this is connected to the corresponding gotrue-js issue; should remove it from the interface for the time being then.

Planned usage would still be:

const { replace } = useHistory();
const { param: { token, type, error, status }, user } = useIdentityContext();

if(error) {
  // access denied
  console.log(status); // 403
  replace('/403');
  return null;
}

if(token) {
  switch(type) {
    case 'recovery':
        replace('/settings/change-password');
        break;
    case 'invite':
        // ...
        break;
    case 'email_change':
        // ...
        break;
  }

  return null;
}

Mainly I wanted to get this PR out so you can take a look at it, I'll probably not get to actually test it this week. Compiles fine though ofc.

@swyxio swyxio changed the title recoverAccount workflow... and a bit more Merge pull request #30 from ljosberinn/master Jan 15, 2020
@swyxio swyxio merged commit b69f231 into netlify-labs:master Jan 15, 2020
@swyxio
Copy link
Contributor

swyxio commented Jan 15, 2020

so sick!! merging and publishing. and inviting you to be collaborator!

@swyxio
Copy link
Contributor

swyxio commented Jan 15, 2020

released v0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants