From 9d2dfad512bd305cb08e2fa54c891df098297fa7 Mon Sep 17 00:00:00 2001 From: gahusb Date: Mon, 11 May 2026 08:56:10 +0900 Subject: [PATCH] =?UTF-8?q?feat(api):=20review=20+=20bulkPurchase=20?= =?UTF-8?q?=ED=97=AC=ED=8D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/api.js b/src/api.js index 64c873a..3f01a47 100644 --- a/src/api.js +++ b/src/api.js @@ -680,3 +680,18 @@ export const getBatchJob = (id) => apiGet(`/api/music/generate-b export const listBatchJobs = (status='all') => apiGet(`/api/music/generate-batch?status=${status}`); export const listGenres = () => apiGet('/api/music/genres'); +// === 주간 회고 (weekly_review) === +// apiGet은 비-2xx 응답에서 `HTTP ...` 메시지로 Error를 throw 하므로 +// 404 케이스는 메시지를 파싱하여 null로 변환한다. +export const getLatestReview = () => apiGet('/api/lotto/review/latest').catch(e => { + if (e?.status === 404 || /^HTTP 404\b/.test(e?.message || '')) return null; + throw e; +}); + +export const getReviewHistory = (limit = 4) => + apiGet(`/api/lotto/review/history?limit=${limit}`).then(d => d.reviews || []); + +// === 큐레이터 4계층 원클릭 구매 === +export const bulkPurchase = ({ draw_no, tier_mode, sets, amount }) => + apiPost('/api/lotto/purchase/bulk', { draw_no, tier_mode, sets, amount }); +