feat(auth): create hook for auth context
This commit is contained in:
parent
d44b560ed1
commit
dcd9021be2
2 changed files with 12 additions and 3 deletions
9
src/hooks/useAuth.tsx
Normal file
9
src/hooks/useAuth.tsx
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { useContext } from 'react';
|
||||||
|
|
||||||
|
import { AuthContext } from '@contexts/AuthContext';
|
||||||
|
|
||||||
|
export function useAuth() {
|
||||||
|
const context = useContext(AuthContext);
|
||||||
|
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
@ -5,13 +5,13 @@ import { Box } from '@gluestack-ui/themed';
|
||||||
import { AuthRoutes } from './auth.routes';
|
import { AuthRoutes } from './auth.routes';
|
||||||
import { AppRoutes } from './app.routes';
|
import { AppRoutes } from './app.routes';
|
||||||
|
|
||||||
import { AuthContext } from '@contexts/AuthContext';
|
|
||||||
|
|
||||||
import { gluestackUIConfig } from '../../config/gluestack-ui.config';
|
import { gluestackUIConfig } from '../../config/gluestack-ui.config';
|
||||||
|
import { useAuth } from '@hooks/useAuth';
|
||||||
|
|
||||||
export function Routes() {
|
export function Routes() {
|
||||||
const theme = DefaultTheme;
|
const theme = DefaultTheme;
|
||||||
const contextData = useContext(AuthContext);
|
const { user } = useAuth();
|
||||||
|
console.debug(user);
|
||||||
|
|
||||||
theme.colors.background = gluestackUIConfig.tokens.colors.gray700;
|
theme.colors.background = gluestackUIConfig.tokens.colors.gray700;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue