@@ -4,6 +4,7 @@ import { BASE_URL } from '@/api/axios.ts';
44import { PostSeatData , postSeat } from '@/api/booking.ts' ;
55import { postReservation } from '@/api/reservation.ts' ;
66
7+ import { toast } from '@/components/Toast/index.ts' ;
78import Button from '@/components/common/Button.tsx' ;
89import Icon from '@/components/common/Icon.tsx' ;
910import Separator from '@/components/common/Separator.tsx' ;
@@ -54,6 +55,7 @@ export default function SectionAndSeat({
5455 ( seat ) => seat . seatIndex !== seatIndex || seat . sectionIndex !== sectionIndex ,
5556 ) ;
5657 setSelectedSeats ( [ ...filtered ] ) ;
58+ toast . error ( '좌석 선택/취소에 실패했습니다' ) ;
5759 } ,
5860 throwOnError : false ,
5961 } ) ;
@@ -241,7 +243,13 @@ const renderSeatMap = (
241243 setSelectedSeats : ( seats : SelectedSeat [ ] ) => void ,
242244 maxSelectCount : number ,
243245 selectedSeats : SelectedSeat [ ] ,
244- pickSeat : ( data : PostSeatData ) => void ,
246+ pickSeat : (
247+ data : PostSeatData ,
248+ mutateOption ?: {
249+ onSuccess ?: ( ) => void ;
250+ onError ?: ( ) => void ;
251+ } ,
252+ ) => void ,
245253 eventId : number ,
246254 reservingList : PostSeatData [ ] ,
247255) => {
@@ -278,23 +286,37 @@ const renderSeatMap = (
278286 const selectedCount = selectedSeats . length ;
279287 if ( isMine ) {
280288 const filtered = selectedSeats . filter ( ( seat ) => seatName !== seat . name ) ;
281- pickSeat ( {
282- sectionIndex : selectedSectionIndex ,
283- seatIndex : index ,
284- expectedStatus : 'deleted' ,
285- eventId,
286- } ) ;
289+ pickSeat (
290+ {
291+ sectionIndex : selectedSectionIndex ,
292+ seatIndex : index ,
293+ expectedStatus : 'deleted' ,
294+ eventId,
295+ } ,
296+ {
297+ onSuccess : ( ) => {
298+ toast . warning ( `${ seatName ! } 좌석을 취소했습니다` ) ;
299+ } ,
300+ } ,
301+ ) ;
287302 setSelectedSeats ( filtered ) ;
288303 return ;
289304 }
290305
291306 if ( maxSelectCount <= selectedCount ) return ;
292- pickSeat ( {
293- sectionIndex : selectedSectionIndex ,
294- seatIndex : index ,
295- expectedStatus : 'reserved' ,
296- eventId,
297- } ) ;
307+ pickSeat (
308+ {
309+ sectionIndex : selectedSectionIndex ,
310+ seatIndex : index ,
311+ expectedStatus : 'reserved' ,
312+ eventId,
313+ } ,
314+ {
315+ onSuccess : ( ) => {
316+ toast . success ( `${ seatName ! } 좌석 선택에\n성공했습니다` ) ;
317+ } ,
318+ } ,
319+ ) ;
298320 setSelectedSeats ( [
299321 ...selectedSeats ,
300322 { seatIndex : index , sectionIndex : selectedSectionIndex , name : seatName ! } ,
0 commit comments