main
|
Last change
on this file was 700e2f9, checked in by 186079 <matej.milevski@…>, 5 days ago |
|
Init
|
-
Property mode
set to
100644
|
|
File size:
1.0 KB
|
| Rev | Line | |
|---|
| [700e2f9] | 1 | import { apiClient } from "@/api/client";
|
|---|
| 2 |
|
|---|
| 3 | export interface Therapy {
|
|---|
| 4 | idTherapy: number;
|
|---|
| 5 | name: string;
|
|---|
| 6 | dose: string;
|
|---|
| 7 | expDate: string;
|
|---|
| 8 | consultationId: number;
|
|---|
| 9 | }
|
|---|
| 10 |
|
|---|
| 11 | export interface CreateTherapyRequest {
|
|---|
| 12 | name: string;
|
|---|
| 13 | dose: string;
|
|---|
| 14 | expDate: string;
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | export interface UpdateTherapyRequest {
|
|---|
| 18 | name?: string;
|
|---|
| 19 | dose?: string;
|
|---|
| 20 | expDate?: string;
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | export const therapyApi = {
|
|---|
| 24 | getTherapiesByConsultation: async (
|
|---|
| 25 | consultationId: number,
|
|---|
| 26 | ): Promise<Therapy[]> =>
|
|---|
| 27 | apiClient.get<Therapy[]>(`/therapies/consultation/${consultationId}`),
|
|---|
| 28 |
|
|---|
| 29 | createTherapy: async (
|
|---|
| 30 | consultationId: number,
|
|---|
| 31 | data: CreateTherapyRequest,
|
|---|
| 32 | ): Promise<Therapy> =>
|
|---|
| 33 | apiClient.post<Therapy>(`/therapies/consultation/${consultationId}`, data),
|
|---|
| 34 |
|
|---|
| 35 | updateTherapy: async (
|
|---|
| 36 | therapyId: number,
|
|---|
| 37 | data: UpdateTherapyRequest,
|
|---|
| 38 | ): Promise<Therapy> =>
|
|---|
| 39 | apiClient.put<Therapy>(`/therapies/${therapyId}`, data),
|
|---|
| 40 |
|
|---|
| 41 | deleteTherapy: async (therapyId: number): Promise<void> =>
|
|---|
| 42 | apiClient.delete<void>(`/therapies/${therapyId}`),
|
|---|
| 43 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.