Categories select + modal

This commit is contained in:
Maarten 2024-08-01 14:21:09 +02:00
parent aaedcec4a6
commit 0999ef563a
6 changed files with 210 additions and 40 deletions

View file

@ -14,10 +14,16 @@ export class Request {
* @returns {Promise<AxiosResponse<any>>}
*/
static get(url: string, headers = {}) {
return axios.get(API_URL + url, {
...CONFIG,
...headers,
});
return axios
.get(API_URL + url, {
...CONFIG,
...headers,
})
.then(response => response.data)
.catch(error => {
// Handle error
throw error;
});
}
/**
@ -29,10 +35,16 @@ export class Request {
* @returns {Promise<AxiosResponse<any>>}
*/
static post(url: string, body = {}, headers = {}) {
return axios.post(API_URL + url, body, {
...CONFIG,
...headers,
});
return axios
.post(API_URL + url, body, {
...CONFIG,
...headers,
})
.then(response => response.data)
.catch(error => {
// Handle error
throw error;
});
}
/**
@ -44,10 +56,16 @@ export class Request {
* @returns {Promise<AxiosResponse<any>>}
*/
static put(url: string, body = {}, headers = {}) {
return axios.put(API_URL + url, body, {
...CONFIG,
...headers,
});
return axios
.put(API_URL + url, body, {
...CONFIG,
...headers,
})
.then(response => response.data)
.catch(error => {
// Handle error
throw error;
});
}
}