Skip to content
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

SignOut() errors: info is null #85

Open
angelod1as opened this issue Jul 20, 2021 · 0 comments
Open

SignOut() errors: info is null #85

angelod1as opened this issue Jul 20, 2021 · 0 comments

Comments

@angelod1as
Copy link

Example code:

import React from 'react'
import MenuItem from '@material-ui/core/MenuItem'
import { navigate } from '@reach/router'
// @ts-ignore
import { useSignOut } from 'croods-auth'

type Props = {
  children: React.ReactNode
}

const SignOut = ({ children }: Props) => {
  const [, signOut] = useSignOut()

  const handleLogout = () => {
    signOut()
    navigate('/login')
  }

  return (
    <MenuItem
      className="text-xs flex gap-2 transition hover:!bg-blue-50"
      role="button"
      onClick={handleLogout}
    >
      {children}
    </MenuItem>
  )
}

export default SignOut

Expected Behavior

When called, signOut() should sign out of the application and throw no errors.

Actual Behavior

Calling signOut() throws an error saying that info is null.

Steps to Reproduce the Problem

  1. Using an app with croods auth, login
  2. Logout using signOut()
  3. See error

Additional info

Debugging, I ended up in a croods file in which setList checks if info.id is true. If info is null, this could probably throw an error, as there's no way to check id in a null.

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

No branches or pull requests

1 participant