main
|
Last change
on this file since 700e2f9 was 700e2f9, checked in by 186079 <matej.milevski@…>, 5 days ago |
|
Init
|
-
Property mode
set to
100644
|
|
File size:
1.1 KB
|
| Rev | Line | |
|---|
| [700e2f9] | 1 | import { UserType } from "@/enums/UserType";
|
|---|
| 2 | import { apiClient } from "@/api/client";
|
|---|
| 3 |
|
|---|
| 4 | export interface LoginRequest {
|
|---|
| 5 | username: string;
|
|---|
| 6 | password: string;
|
|---|
| 7 | }
|
|---|
| 8 |
|
|---|
| 9 | export interface LoginResponse {
|
|---|
| 10 | token: string;
|
|---|
| 11 | username: string;
|
|---|
| 12 | email: string;
|
|---|
| 13 | userType: UserType;
|
|---|
| 14 | userId: number;
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | export interface RegisterPatientRequest {
|
|---|
| 18 | username: string;
|
|---|
| 19 | password: string;
|
|---|
| 20 | name: string;
|
|---|
| 21 | surname: string;
|
|---|
| 22 | email: string;
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | export interface RegisterTherapistRequest {
|
|---|
| 26 | username: string;
|
|---|
| 27 | password: string;
|
|---|
| 28 | name: string;
|
|---|
| 29 | surname: string;
|
|---|
| 30 | email: string;
|
|---|
| 31 | officeLocation: string;
|
|---|
| 32 | degree: string;
|
|---|
| 33 | yearsExp: number;
|
|---|
| 34 | phoneNumber: string;
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | export const authApi = {
|
|---|
| 38 | login: async (credentials: LoginRequest): Promise<LoginResponse> =>
|
|---|
| 39 | apiClient.post<LoginResponse>("/auth/login", credentials),
|
|---|
| 40 |
|
|---|
| 41 | registerPatient: async (
|
|---|
| 42 | data: RegisterPatientRequest,
|
|---|
| 43 | ): Promise<LoginResponse> =>
|
|---|
| 44 | apiClient.post<LoginResponse>("/auth/register/patient", data),
|
|---|
| 45 |
|
|---|
| 46 | registerTherapist: async (
|
|---|
| 47 | data: RegisterTherapistRequest,
|
|---|
| 48 | ): Promise<LoginResponse> =>
|
|---|
| 49 | apiClient.post<LoginResponse>("/auth/register/therapist", data),
|
|---|
| 50 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.