Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 3x 3x 3x 2x 2x 2x 2x 2x | import { fetchApi } from '@/lib/api/core/fetchWrappers';
import {Offre} from '@/types/offre/offre';
export class OffreService {
private static readonly BASE_PATH = '/offre';
static async getAll(): Promise<Offre[]> {
return fetchApi<Offre[]>(`${this.BASE_PATH}/`, {}, false);
}
static async getById(id: number): Promise<Offre> {
return fetchApi<Offre>(`${this.BASE_PATH}/${id}/`);
}
static async create(data: Offre): Promise<Offre> {
return fetchApi<Offre>(`${this.BASE_PATH}/create/`, {
method: 'POST',
body: JSON.stringify(data),
});
}
static async update(data: Offre): Promise<Offre> {
return fetchApi<Offre>(`${this.BASE_PATH}/update/${data.id}/`, {
method: 'PUT',
body: JSON.stringify(data),
});
}
static async delete(id: number): Promise<void> {
return fetchApi<void>(`${this.BASE_PATH}/delete/${id}/`, {
method: 'DELETE',
});
}
}
|