Created
December 2, 2020 00:24
-
-
Save mentix02/e61e50195f83955d477d7776af4fc0ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useSelector } from "react-redux"; | |
import { AuthState } from "./types"; | |
export const useAuthenticated = (): boolean => | |
useSelector(({ auth }: { auth: AuthState }) => auth.isAuthenticated); | |
export const useToken = (): string | undefined => | |
useSelector(({ auth }: { auth: AuthState }) => auth.token); | |
export const useUsername = (): string | undefined => | |
useSelector(({ auth }: { auth: AuthState }) => auth.username); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment