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

[BUG] Auth State in AppBar #116

Closed
ballyalley-o opened this issue Apr 9, 2024 · 1 comment · Fixed by #118
Closed

[BUG] Auth State in AppBar #116

ballyalley-o opened this issue Apr 9, 2024 · 1 comment · Fixed by #118
Assignees

Comments

@ballyalley-o
Copy link
Owner

Describe the bug
the user slice initialized in the appbar is not being recognized.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'login page'
  2. log in using your account
  3. this will navigate you to dashboard, you'll see that the login and register still there, and if you check the localstorage you are actually logged in.
  const selectAuth = (state: any) => state.auth
  const selectUser = createSelector([selectAuth], (auth) => auth.user || {})
  const { user } = useSelector(selectUser)

Expected behavior
Log in and register button shouldn't be present when authenticated.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@ballyalley-o ballyalley-o added the bug Something isn't working label Apr 9, 2024
@ballyalley-o ballyalley-o moved this to 🗂️ Backlog in The Code Coach Projct™ Apr 9, 2024
@ballyalley-o ballyalley-o moved this from 🗂️ Backlog to Sprint 2 in The Code Coach Projct™ Apr 9, 2024
@ballyalley-o ballyalley-o self-assigned this Apr 9, 2024
@ballyalley-o ballyalley-o moved this from Sprint 2 to In Progress in The Code Coach Projct™ Apr 9, 2024
@ballyalley-o ballyalley-o moved this from In Progress to in QA in The Code Coach Projct™ Apr 9, 2024
@ballyalley-o ballyalley-o added solved and removed bug Something isn't working labels Apr 9, 2024
@ballyalley-o
Copy link
Owner Author

had to change user instance from auth.user to auth:

app-appbar.tsx

  const selectAuth = (state: any) => state.auth
  const selectUser = createSelector([selectAuth], (auth) => auth.user || {})
  const { user } = useSelector(selectUser)

to:

const { user } = useSelector((state: any) => state.auth)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant