65 lines
2.3 KiB
TypeScript
65 lines
2.3 KiB
TypeScript
// 협상 엔드포인트 호출 함수 (순수 HTTP 레이어, React 의존 없음).
|
|
import { http } from '@/apis/http'
|
|
import type {
|
|
ExtraInfoRequest,
|
|
ExtraInfoResponse,
|
|
ParticipateResponse,
|
|
RejectRequest,
|
|
RejectResponse,
|
|
RenegotiationRequest,
|
|
RenegotiationResponse,
|
|
SessionListParams,
|
|
SessionListResponse,
|
|
} from './negotiation.type'
|
|
|
|
export const negotiationApi = {
|
|
/** GET /v1/negotiation/sessions — 로그인 공급사의 협상 세션 목록(필터/정렬/페이지) */
|
|
getSessions: async (params: SessionListParams = {}): Promise<SessionListResponse> => {
|
|
const res = await http.get<SessionListResponse>('/v1/negotiation/sessions', { params })
|
|
return res.data
|
|
},
|
|
|
|
/** POST /v1/negotiation/sessions/{id}/participate — 협상 세션 참여 */
|
|
participate: async (sessionId: string): Promise<ParticipateResponse> => {
|
|
const res = await http.post<ParticipateResponse>(
|
|
`/v1/negotiation/sessions/${sessionId}/participate`,
|
|
)
|
|
return res.data
|
|
},
|
|
|
|
/** POST /v1/negotiation/sessions/{id}/reject — 협상 세션 거부 */
|
|
reject: async (sessionId: string, body: RejectRequest): Promise<RejectResponse> => {
|
|
const res = await http.post<RejectResponse>(
|
|
`/v1/negotiation/sessions/${sessionId}/reject`,
|
|
body,
|
|
)
|
|
return res.data
|
|
},
|
|
|
|
/** POST /v1/negotiation/session/{id}/renegotiation — 결렬 건 재협상 요청 */
|
|
requestRenegotiation: async (sessionId: string, body: RenegotiationRequest): Promise<RenegotiationResponse> => {
|
|
const res = await http.post<RenegotiationResponse>(
|
|
`/v1/negotiation/session/${sessionId}/renegotiation`,
|
|
body,
|
|
)
|
|
return res.data
|
|
},
|
|
|
|
/** DELETE /v1/negotiation/session/{id}/renegotiation — 심사 대기 중인 요청 철회 */
|
|
cancelRenegotiation: async (sessionId: string): Promise<RenegotiationResponse> => {
|
|
const res = await http.delete<RenegotiationResponse>(
|
|
`/v1/negotiation/session/${sessionId}/renegotiation`,
|
|
)
|
|
return res.data
|
|
},
|
|
|
|
/** POST /v1/negotiation/sessions/{id}/extra-info — 협상완료 부가정보 저장 */
|
|
saveExtraInfo: async (sessionId: string, body: ExtraInfoRequest): Promise<ExtraInfoResponse> => {
|
|
const res = await http.post<ExtraInfoResponse>(
|
|
`/v1/negotiation/sessions/${sessionId}/extra-info`,
|
|
body,
|
|
)
|
|
return res.data
|
|
},
|
|
}
|