|
1 | | -import { apiSlice } from "./baseApiSlice"; |
2 | | -import { TIMETABLES_URL } from "./config"; |
| 1 | +import {apiSlice} from './baseApiSlice'; |
| 2 | +import {TIMETABLES_URL} from './config'; |
3 | 3 |
|
4 | 4 | // Endpoints for /api/timetables |
5 | 5 | export const timetableApiSlice = apiSlice.injectEndpoints({ |
6 | 6 | endpoints: (builder) => ({ |
7 | 7 | createTimetable: builder.mutation({ |
8 | 8 | query: (data) => ({ |
9 | 9 | url: `${TIMETABLES_URL}`, |
10 | | - method: "POST", |
| 10 | + method: 'POST', |
11 | 11 | headers: { |
12 | | - "Content-Type": "application/json", |
13 | | - Accept: "application/json, text/plain, */*", |
| 12 | + 'Content-Type': 'application/json', |
| 13 | + Accept: 'application/json, text/plain, */*', |
14 | 14 | }, |
15 | 15 | body: data, |
16 | | - credentials: "include", |
| 16 | + credentials: 'include', |
17 | 17 | }), |
18 | | - invalidatesTags: ["Timetable"], |
| 18 | + invalidatesTags: ['Timetable'], |
19 | 19 | }), |
20 | 20 | getTimetables: builder.query<unknown, void>({ |
21 | 21 | query: () => ({ |
22 | 22 | url: `${TIMETABLES_URL}`, |
23 | | - method: "GET", |
| 23 | + method: 'GET', |
24 | 24 | headers: { |
25 | | - "Content-Type": "application/json", |
26 | | - Accept: "application/json, text/plain, */*", |
| 25 | + 'Content-Type': 'application/json', |
| 26 | + Accept: 'application/json, text/plain, */*', |
27 | 27 | }, |
28 | | - providesTags: ["Timetable"], |
29 | | - credentials: "include", |
| 28 | + providesTags: ['Timetable'], |
| 29 | + credentials: 'include', |
30 | 30 | }), |
31 | 31 | keepUnusedDataFor: 0, |
32 | 32 | }), |
33 | | - getTimetable: builder.query<unknown, string | number>({ |
| 33 | + getTimetable: builder.query<unknown, string|number>({ |
34 | 34 | query: (id) => ({ |
35 | 35 | url: `${TIMETABLES_URL}/${id}`, |
36 | | - method: "GET", |
| 36 | + method: 'GET', |
37 | 37 | headers: { |
38 | | - "Content-Type": "application/json", |
39 | | - Accept: "application/json, text/plain, */*", |
| 38 | + 'Content-Type': 'application/json', |
| 39 | + Accept: 'application/json, text/plain, */*', |
40 | 40 | }, |
41 | | - credentials: "include", |
| 41 | + credentials: 'include', |
42 | 42 | }), |
| 43 | + keepUnusedDataFor: 0 |
43 | 44 | }), |
44 | 45 | updateTimetable: builder.mutation({ |
45 | 46 | query: (data) => ({ |
46 | 47 | url: `${TIMETABLES_URL}/${data.id}`, |
47 | | - method: "PUT", |
| 48 | + method: 'PUT', |
48 | 49 | headers: { |
49 | | - "Content-Type": "application/json", |
50 | | - Accept: "application/json, text/plain, */*", |
| 50 | + 'Content-Type': 'application/json', |
| 51 | + Accept: 'application/json, text/plain, */*', |
51 | 52 | }, |
52 | 53 | body: data, |
53 | | - credentials: "include", |
| 54 | + credentials: 'include', |
54 | 55 | }), |
55 | | - invalidatesTags: ["Timetable"], |
| 56 | + invalidatesTags: ['Timetable'], |
56 | 57 | }), |
57 | 58 | deleteTimetable: builder.mutation({ |
58 | 59 | query: (id) => ({ |
59 | 60 | url: `${TIMETABLES_URL}/${id}`, |
60 | | - method: "DELETE", |
| 61 | + method: 'DELETE', |
61 | 62 | headers: { |
62 | | - "Content-Type": "application/json", |
63 | | - Accept: "application/json, text/plain, */*", |
| 63 | + 'Content-Type': 'application/json', |
| 64 | + Accept: 'application/json, text/plain, */*', |
64 | 65 | }, |
65 | | - credentials: "include", |
| 66 | + credentials: 'include', |
66 | 67 | }), |
67 | | - invalidatesTags: ["Timetable"], |
| 68 | + invalidatesTags: ['Timetable'], |
68 | 69 | }), |
69 | 70 | generateTimetable: builder.mutation({ |
70 | 71 | query: (data) => ({ |
71 | 72 | url: `${TIMETABLES_URL}/generate`, |
72 | | - method: "POST", |
| 73 | + method: 'POST', |
73 | 74 | headers: { |
74 | | - "Content-Type": "application/json", |
75 | | - Accept: "application/json, text/plain, */*", |
| 75 | + 'Content-Type': 'application/json', |
| 76 | + Accept: 'application/json, text/plain, */*', |
76 | 77 | }, |
77 | 78 | body: data, |
78 | | - credentials: "include", |
| 79 | + credentials: 'include', |
79 | 80 | }), |
80 | 81 | }), |
81 | 82 | }), |
|
0 commit comments