feat(auth): create hook for auth context

This commit is contained in:
Vinicius Souza 2024-10-30 10:34:49 -03:00
parent d44b560ed1
commit dcd9021be2
2 changed files with 12 additions and 3 deletions

9
src/hooks/useAuth.tsx Normal file
View file

@ -0,0 +1,9 @@
import { useContext } from 'react';
import { AuthContext } from '@contexts/AuthContext';
export function useAuth() {
const context = useContext(AuthContext);
return context;
}

View file

@ -5,13 +5,13 @@ import { Box } from '@gluestack-ui/themed';
import { AuthRoutes } from './auth.routes';
import { AppRoutes } from './app.routes';
import { AuthContext } from '@contexts/AuthContext';
import { gluestackUIConfig } from '../../config/gluestack-ui.config';
import { useAuth } from '@hooks/useAuth';
export function Routes() {
const theme = DefaultTheme;
const contextData = useContext(AuthContext);
const { user } = useAuth();
console.debug(user);
theme.colors.background = gluestackUIConfig.tokens.colors.gray700;