auto-directory/src/api/carColors.ts
2025-01-29 15:09:27 +05:00

42 lines
1.1 KiB
TypeScript

export async function list () {
const response = await fetch('/api/v1/car-colors');
return (await response.json()).results.rows;
}
export async function add (params: any) {
const response = await fetch('/api/v1/car-colors', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(params)
});
return await response.json();
}
export async function update (params: any) {
const response = await fetch('/api/v1/car-colors', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
updates: params,
where: {
id: params.id,
}
})
});
return await response.json();
}
export async function remove (params: any) {
const response = await fetch('/api/v1/car-colors', {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(params)
});
return await response.json();
}