Skip to content

Commit

Permalink
feat: add interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ialexanderbrito committed Mar 25, 2022
1 parent f862654 commit a725cd9
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/types/IComponents.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* eslint-disable no-unused-vars */
export interface ButtonProps {
type: 'button' | 'submit' | 'reset';
children: React.ReactNode;
onClick?: () => void;
}

export interface ButtonGoogleProps {
type: 'button' | 'submit' | 'reset';
onClick: () => void;
}

export interface HeaderProps {
name?: string;
profile?: string;
avatar?: string;
logo?: boolean;
default?: boolean;
back?: boolean;
}

export interface InputProps {
icon: React.ReactNode;
type: 'text' | 'password' | 'email' | 'number';
name: string;
placeholder: string;
value: string;
maxLength?: number;
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
onBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
}
76 changes: 76 additions & 0 deletions src/types/IContext.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/* eslint-disable no-unused-vars */

export interface AppMetadata {
provider: string;
providers: string[];
}

export interface UserMetadata {
avatar_url: string;
email: string;
email_verified: boolean;
full_name: string;
iss: string;
name: string;
picture: string;
provider_id: string;
ocupacao: string;
sub: string;
}

export interface IdentityData {
sub: string;
avatar_url: string;
email: string;
email_verified?: boolean;
full_name: string;
iss: string;
name: string;
picture: string;
provider_id: string;
}

export interface Identity {
id: string;
user_id: string;
identity_data: IdentityData;
provider: string;
last_sign_in_at: Date;
created_at: Date;
updated_at: Date;
}

export interface User {
id: string;
aud: string;
role: string;
email: string;
email_confirmed_at: Date;
phone: string;
confirmation_sent_at: Date;
confirmed_at: Date;
last_sign_in_at: string;
app_metadata: AppMetadata;
user_metadata: UserMetadata;
identities: Identity[];
created_at: Date;
updated_at: Date;
}

export interface UserAuth {
access_token: string;
token_interface: string;
expires_in: number;
refresh_token: string;
user: User;
}

export interface AuthContextProps {
user: User | null;
setUser: (user: any) => void;
handleLogout: () => void;
handleLoginGoogle: () => void;
formikLogin: any;
ocupacao: string;
setOcupacao: (ocupacao: string) => void;
}

0 comments on commit a725cd9

Please sign in to comment.