From 6cae1cc7f3ae494f437174c2d03741647b82afdb Mon Sep 17 00:00:00 2001 From: Vinicius Souza Date: Wed, 30 Oct 2024 09:45:44 -0300 Subject: [PATCH] feat: add auth context typings --- App.tsx | 10 ++++++---- src/contexts/AuthContext.tsx | 8 +++++++- src/dtos/UserDTO.ts | 6 ++++++ 3 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 src/dtos/UserDTO.ts diff --git a/App.tsx b/App.tsx index da09be5..afee5a8 100644 --- a/App.tsx +++ b/App.tsx @@ -19,10 +19,12 @@ export default function App() { {fontsLoaded ? : } diff --git a/src/contexts/AuthContext.tsx b/src/contexts/AuthContext.tsx index 426cf75..77f7bf4 100644 --- a/src/contexts/AuthContext.tsx +++ b/src/contexts/AuthContext.tsx @@ -1,3 +1,9 @@ import { createContext } from 'react'; -export const AuthContext = createContext({}); +import { UserDTO } from '@dtos/UserDTO'; + +type AuthContextData = { + user: UserDTO; +}; + +export const AuthContext = createContext({} as AuthContextData); diff --git a/src/dtos/UserDTO.ts b/src/dtos/UserDTO.ts new file mode 100644 index 0000000..26a8026 --- /dev/null +++ b/src/dtos/UserDTO.ts @@ -0,0 +1,6 @@ +export type UserDTO = { + id: string; + name: string; + email: string; + avatar: string; +};