1- import { useEffect , useState , type MouseEvent } from 'react' ;
1+ import { useEffect , useState } from 'react' ;
22import Button from '../Button' ;
3- import TableStatus from './TableStatus' ;
4- import { putNoticeApplications } from '@/api/applicationApi' ;
53
64interface Props {
75 index : number ;
86 click : ( dataIndex : number , status : 'accepted' | 'rejected' ) => void ;
97}
108
119export default function TableButtons ( { index, click } : Props ) {
12- const [ status , setStatus ] = useState < 'pending' | 'accepted' | 'rejected' > (
13- 'pending' ,
14- ) ;
1510 const [ isMobile , setIsMobile ] = useState ( window . innerWidth < 768 ) ;
1611
17- const handleModalClick = async ( ) => {
18- closeModal ( ) ;
19- setStatus ( modal . status ) ;
20- try {
21- await putNoticeApplications ( shopId , noticeId , applicaitonId , {
22- status : modal . status ,
23- } ) ;
24- } catch {
25- setStatus ( 'pending' ) ;
26- }
27- } ;
28-
2912 useEffect ( ( ) => {
3013 const handleResize = ( ) => {
3114 setIsMobile ( window . innerWidth < 768 ) ;
@@ -34,7 +17,7 @@ export default function TableButtons({ index, click }: Props) {
3417 return ( ) => window . removeEventListener ( 'resize' , handleResize ) ;
3518 } , [ ] ) ;
3619
37- return status === 'pending' ? (
20+ return (
3821 < div className = "flex gap-8 md:gap-12" >
3922 < Button
4023 solid = { false }
@@ -59,7 +42,5 @@ export default function TableButtons({ index, click }: Props) {
5942 ์น์ธํ๊ธฐ
6043 </ Button >
6144 </ div >
62- ) : (
63- < TableStatus status = { status } />
6445 ) ;
6546}
0 commit comments