feat: add auth context typings
This commit is contained in:
parent
e6d880ef8a
commit
6cae1cc7f3
3 changed files with 19 additions and 5 deletions
10
App.tsx
10
App.tsx
|
|
@ -19,10 +19,12 @@ export default function App() {
|
|||
<GluestackUIProvider config={config}>
|
||||
<AuthContext.Provider
|
||||
value={{
|
||||
id: '1',
|
||||
name: 'John Doe',
|
||||
email: 'john.doe@email.com',
|
||||
avatar: 'https://i.pravatar.cc/200',
|
||||
user: {
|
||||
id: '1',
|
||||
name: 'John Doe',
|
||||
email: 'john.doe@email.com',
|
||||
avatar: 'https://i.pravatar.cc/200',
|
||||
},
|
||||
}}>
|
||||
{fontsLoaded ? <Routes /> : <Loading />}
|
||||
</AuthContext.Provider>
|
||||
|
|
|
|||
|
|
@ -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<AuthContextData>({} as AuthContextData);
|
||||
|
|
|
|||
6
src/dtos/UserDTO.ts
Normal file
6
src/dtos/UserDTO.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export type UserDTO = {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
avatar: string;
|
||||
};
|
||||
Loading…
Reference in a new issue