|
1 | 1 | import axios, { AxiosPromise } from "axios";
|
2 |
| -import { APIClient } from "@app/axios-config"; |
3 | 2 |
|
4 | 3 | import {
|
5 | 4 | AnalysisDependency,
|
@@ -136,7 +135,7 @@ export const getApplicationDependencies = (
|
136 | 135 | return axios
|
137 | 136 | .get(`${APPLICATION_DEPENDENCY}`, {
|
138 | 137 | params,
|
139 |
| - headers: jsonHeaders, |
| 138 | + headers: jsonHeaders.headers, |
140 | 139 | })
|
141 | 140 | .then((response) => response.data);
|
142 | 141 | };
|
@@ -179,21 +178,17 @@ export const deleteReview = (id: number): Promise<Review> => {
|
179 | 178 | return axios.delete(`${REVIEWS}/${id}`);
|
180 | 179 | };
|
181 | 180 |
|
182 |
| -export const getApplicationAdoptionPlan = ( |
183 |
| - applicationIds: number[] |
184 |
| -): AxiosPromise<ApplicationAdoptionPlan[]> => { |
185 |
| - return APIClient.post( |
| 181 | +export const getApplicationAdoptionPlan = (applicationIds: number[]) => { |
| 182 | + return axios.post<ApplicationAdoptionPlan[]>( |
186 | 183 | `${REPORT}/adoptionplan`,
|
187 |
| - applicationIds.map((f) => ({ |
188 |
| - applicationId: f, |
189 |
| - })) |
| 184 | + applicationIds.map((f) => ({ applicationId: f })) |
190 | 185 | );
|
191 | 186 | };
|
192 | 187 |
|
193 |
| -export const getApplicationSummaryCSV = (id: string): AxiosPromise => { |
194 |
| - return APIClient.get(`${APP_IMPORT_CSV}?importSummaryId=${id}`, { |
| 188 | +export const getApplicationSummaryCSV = (id: string) => { |
| 189 | + return axios.get<ArrayBuffer>(`${APP_IMPORT_CSV}?importSummary.id=${id}`, { |
195 | 190 | responseType: "arraybuffer",
|
196 |
| - headers: { Accept: "text/csv", responseType: "blob" }, |
| 191 | + headers: { Accept: "text/csv" }, |
197 | 192 | });
|
198 | 193 | };
|
199 | 194 |
|
@@ -241,28 +236,26 @@ export const getAssessmentById = (id: number | string): Promise<Assessment> => {
|
241 | 236 | return axios.get(`${ASSESSMENTS}/${id}`).then((response) => response.data);
|
242 | 237 | };
|
243 | 238 |
|
244 |
| -export const deleteAssessment = (id: number): AxiosPromise => { |
245 |
| - return APIClient.delete(`${ASSESSMENTS}/${id}`); |
| 239 | +export const deleteAssessment = (id: number) => { |
| 240 | + return axios.delete<void>(`${ASSESSMENTS}/${id}`); |
246 | 241 | };
|
247 | 242 |
|
248 |
| -export const getIdentities = (): AxiosPromise<Array<Identity>> => { |
249 |
| - return APIClient.get(`${IDENTITIES}`, jsonHeaders); |
| 243 | +export const getIdentities = () => { |
| 244 | + return axios.get<Identity[]>(`${IDENTITIES}`, jsonHeaders); |
250 | 245 | };
|
251 | 246 |
|
252 |
| -export const createIdentity = (obj: New<Identity>): AxiosPromise<Identity> => { |
253 |
| - return APIClient.post(`${IDENTITIES}`, obj); |
| 247 | +export const createIdentity = (obj: New<Identity>) => { |
| 248 | + return axios.post<Identity>(`${IDENTITIES}`, obj); |
254 | 249 | };
|
255 | 250 |
|
256 |
| -export const updateIdentity = (obj: Identity): AxiosPromise<Identity> => { |
257 |
| - return APIClient.put(`${IDENTITIES}/${obj.id}`, obj); |
| 251 | +export const updateIdentity = (obj: Identity) => { |
| 252 | + return axios.put<void>(`${IDENTITIES}/${obj.id}`, obj); |
258 | 253 | };
|
259 | 254 |
|
260 |
| -export const deleteIdentity = (identity: Identity): AxiosPromise => { |
261 |
| - return APIClient.delete(`${IDENTITIES}/${identity.id}`); |
| 255 | +export const deleteIdentity = (identity: Identity) => { |
| 256 | + return axios.delete<void>(`${IDENTITIES}/${identity.id}`); |
262 | 257 | };
|
263 | 258 |
|
264 |
| -// Axios direct |
265 |
| - |
266 | 259 | // success with code 201 and created entity as response data
|
267 | 260 | export const createApplication = (application: New<Application>) =>
|
268 | 261 | axios
|
|
0 commit comments