From d44b560ed1f0f0e25948671b210d33cd9873df89 Mon Sep 17 00:00:00 2001 From: Vinicius Souza Date: Wed, 30 Oct 2024 10:16:22 -0300 Subject: [PATCH] feat(auth): add Auth Context provider with user data refactoring --- App.tsx | 15 +++------------ src/contexts/AuthContext.tsx | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/App.tsx b/App.tsx index afee5a8..197519a 100644 --- a/App.tsx +++ b/App.tsx @@ -4,7 +4,7 @@ import { GluestackUIProvider } from '@gluestack-ui/themed'; import { config } from './config/gluestack-ui.config'; -import { AuthContext } from '@contexts/AuthContext'; +import { AuthContextProvider } from '@contexts/AuthContext'; import { Loading } from '@components/Loading'; import { Routes } from '@routes/index'; @@ -17,17 +17,8 @@ export default function App() { return ( - - {fontsLoaded ? : } - + {fontsLoaded ? : } + ); diff --git a/src/contexts/AuthContext.tsx b/src/contexts/AuthContext.tsx index 77f7bf4..789d11f 100644 --- a/src/contexts/AuthContext.tsx +++ b/src/contexts/AuthContext.tsx @@ -6,4 +6,24 @@ type AuthContextData = { user: UserDTO; }; +type AuthContextProviderProps = { + children: React.ReactNode; +}; + export const AuthContext = createContext({} as AuthContextData); + +export function AuthContextProvider({ children }: AuthContextProviderProps) { + return ( + + {children} + + ); +}