Fakultas Ilmu Komputer UI

types.ts 640 Bytes
Newer Older
1
import { ApiResponse } from 'services/api';
2
3
4
5
import {
  LoginRequest,
  LoginResponse,
  RegistrationRequest,
6
  LinkUserDataResponse,
7
  AuthUserResponse,
8
} from 'services/auth/models';
9
10

export interface iUserContext {
11
  user: AuthUserResponse;
12
13
  isAuthenticated: boolean;
  isLoading: boolean;
14
  isFirstLoading: boolean;
15
  setUser: (_: AuthUserResponse) => void;
16
  getUser: () => Promise<void>;
17
18
19
  signup: (
    data: RegistrationRequest,
  ) => ApiResponse<LoginResponse | LinkUserDataResponse>;
20
  login: (data: LoginRequest) => ApiResponse<LoginResponse>;
21
  loginWithGoogle: (_?: boolean) => Promise<void>;
22
23
  logout: () => Promise<void>;
}