|
| 1 | +import type { AxiosResponse } from "axios"; |
| 2 | +import { |
| 3 | + NoticeResponse, |
| 4 | + NoticePayload, |
| 5 | + GetNoticesParams, |
| 6 | + NoticeListResponseWithoutUserApplication, |
| 7 | +} from "src/types"; |
| 8 | + |
| 9 | +import requestor from "../client/requestor"; |
| 10 | + |
| 11 | +/* 공고 조회 */ |
| 12 | +export const getNotices = ( |
| 13 | + params?: GetNoticesParams, |
| 14 | +): Promise<AxiosResponse<NoticeListResponseWithoutUserApplication>> => { |
| 15 | + return requestor.get("/notices", { params }); |
| 16 | +}; |
| 17 | + |
| 18 | +/* 가게의 공고 목록 조회 */ |
| 19 | +export const getShopNotices = ( |
| 20 | + shopId: string, |
| 21 | + offset?: number, |
| 22 | + limit?: number, |
| 23 | +): Promise<AxiosResponse<NoticeListResponseWithoutUserApplication>> => { |
| 24 | + return requestor.get(`/shops/${shopId}/notices`, { |
| 25 | + params: { offset, limit }, |
| 26 | + }); |
| 27 | +}; |
| 28 | + |
| 29 | +/* 가게 공고 등록 */ |
| 30 | +export const postNotice = ( |
| 31 | + shopId: string, |
| 32 | + payload: NoticePayload, |
| 33 | +): Promise<AxiosResponse<NoticeResponse>> => { |
| 34 | + return requestor.post(`/shops/${shopId}/notices`, payload); |
| 35 | +}; |
| 36 | + |
| 37 | +/* 가게의 특정 공고 조회 */ |
| 38 | +export const getNotice = ( |
| 39 | + shopId: string, |
| 40 | + noticeId: string, |
| 41 | +): Promise<AxiosResponse<NoticeResponse>> => { |
| 42 | + return requestor.get(`/shops/${shopId}/notices/${noticeId}`); |
| 43 | +}; |
| 44 | + |
| 45 | +/* 가게의 특정 공고 수정 */ |
| 46 | +export const putNotice = ( |
| 47 | + shopId: string, |
| 48 | + noticeId: string, |
| 49 | + payload: NoticePayload, |
| 50 | +): Promise<AxiosResponse<NoticeResponse>> => { |
| 51 | + return requestor.put(`/shops/${shopId}/notices/${noticeId}`, payload); |
| 52 | +}; |
0 commit comments