- auth/negotiation 도메인별 api/keys/queries/mutations/type 5파일 구조 - axios 인스턴스: access token 주입, 434 만료 시 refresh 자동 재발급(단일 비행) 후 원요청 재시도, 433/435/1203(TOKEN_REVOKED) 시 세션 종료 처리 - HTTP 200 + result.success=false 비즈니스 에러를 ApiError 로 변환, 에러코드별 한국어 메시지 맵(getApiErrorMessage) 제공 - 토큰 localStorage 저장소(tokenStorage) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
// 협상 엔드포인트 호출 함수 (순수 HTTP 레이어, React 의존 없음).
|
|
import { http } from '@/apis/http'
|
|
import type {
|
|
ParticipateResponse,
|
|
RejectRequest,
|
|
RejectResponse,
|
|
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
|
|
},
|
|
}
|