File tree Expand file tree Collapse file tree 5 files changed +42
-19
lines changed Expand file tree Collapse file tree 5 files changed +42
-19
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,8 @@ import client from './client';
33const postReports = async ( postReportRequest : PostReportRequest ) => {
44 try {
55 const res = await client . post ( `/api/reports` , postReportRequest ) ;
6- if ( res . status === 200 ) {
7- return res ;
8- }
6+ if ( ! res ) throw new Error ( '신고 요청중 에러가 발생했습니다.' ) ;
7+ return res ;
98 } catch ( error ) {
109 console . error ( error ) ;
1110 }
@@ -51,25 +50,22 @@ const getBadWords = async (setBadWords: React.Dispatch<React.SetStateAction<BadW
5150 }
5251} ;
5352
54- const postBadWords = async ( badWordsRequest : BadWords , callBack ?: ( ) => void ) => {
53+ const postBadWords = async ( badWordsRequest : BadWords ) => {
5554 try {
5655 const res = await client . post ( '/api/bad-words' , badWordsRequest ) ;
57- if ( callBack ) callBack ( ) ;
5856 console . log ( res ) ;
57+ if ( ! res ) throw new Error ( '금칙어 등록 도중 에러가 발생했습니다.' ) ;
58+ return res ;
5959 } catch ( error ) {
6060 console . error ( error ) ;
6161 }
6262} ;
6363
6464// 내 상상대로 만든 필터링 단어 취소 버튼
65- const patchBadWords = async (
66- badWordId : number ,
67- badWordsRequest : BadWords ,
68- callBack ?: ( ) => void ,
69- ) => {
65+ const patchBadWords = async ( badWordId : number ) => {
7066 try {
71- const res = await client . patch ( `/api/bad-words/${ badWordId } /status` , badWordsRequest ) ;
72- if ( callBack ) callBack ( ) ;
67+ const res = await client . patch ( `/api/bad-words/${ badWordId } /status` , { isUsed : false } ) ;
68+ if ( ! res ) throw new Error ( '검열 단어 삭제 도중 에러가 발생했습니다.' ) ;
7369 console . log ( res ) ;
7470 } catch ( error ) {
7571 console . error ( error ) ;
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ export default function ReportManage() {
2828 reportType : null ,
2929 status : 'PENDING' ,
3030 page : '1' ,
31- size : '2 ' ,
31+ size : '1 ' ,
3232 } ) ;
3333
3434 const handleGetReports = async ( reportQueryString : ReportQueryString ) => {
@@ -47,14 +47,30 @@ export default function ReportManage() {
4747 setReportQueryString ( ( cur ) => ( { ...cur , page : page } ) ) ;
4848 } ;
4949
50+ const handleStatus = ( status : Status ) => {
51+ setReportQueryString ( ( cur ) => ( { ...cur , status : status } ) ) ;
52+ } ;
53+
5054 useEffect ( ( ) => {
5155 handleGetReports ( reportQueryString ) ;
5256 } , [ reportQueryString ] ) ;
5357 return (
5458 < >
5559 < AdminPageTitle > 검열 관리 / 신고 편지 목록</ AdminPageTitle >
5660 < WrapperFrame >
57- < WrapperTitle title = "신고 편지 목록" Icon = { AlarmIcon } />
61+ < div className = "flex items-center justify-between" >
62+ < WrapperTitle title = "신고 편지 목록" Icon = { AlarmIcon } />
63+ < select
64+ onChange = { ( e ) => {
65+ const status = e . currentTarget . value as Status ;
66+ handleStatus ( status ) ;
67+ } }
68+ >
69+ < option value = "PENDING" > 대기중</ option >
70+ < option value = "RESOLVED" > 승인됨</ option >
71+ < option value = "REJECTED" > 거절됨</ option >
72+ </ select >
73+ </ div >
5874
5975 < section className = "mt-5 flex flex-col" >
6076 < ListHeaderFrame >
Original file line number Diff line number Diff line change @@ -19,12 +19,13 @@ export default function AddInputButton({
1919 target . style . width = `${ target . scrollWidth } px` ;
2020 } ;
2121
22- const handlePostBadWords = ( ) => {
22+ const handlePostBadWords = async ( ) => {
2323 if ( inputText . word === '' ) return setAddInputShow ( false ) ;
24- postBadWords ( inputText , ( ) => {
24+ const res = await postBadWords ( inputText ) ;
25+ if ( res ?. status === 200 ) {
2526 setBadWords ( ( cur ) => [ ...cur , inputText ] ) ;
2627 setAddInputShow ( false ) ;
27- } ) ;
28+ }
2829 } ;
2930
3031 useEffect ( ( ) => {
Original file line number Diff line number Diff line change @@ -50,7 +50,8 @@ export default function PagenationNavigation({
5050 }
5151 } ;
5252
53- const buttonStyle = 'rounded-full bg-white w-8 h-8 disabled:bg-gray-20' ;
53+ const buttonStyle =
54+ 'rounded-full bg-white w-8 h-8 disabled:bg-gray-20 disabled:text-white disabled:cursor-auto' ;
5455
5556 return (
5657 < div className = "mt-5 flex h-10 w-full items-center justify-center" >
Original file line number Diff line number Diff line change @@ -48,7 +48,16 @@ const NotificationsPage = () => {
4848
4949 const handlePatchReadNotification = async ( timelineId : number ) => {
5050 const res = await patchReadNotification ( timelineId ) ;
51- if ( res ?. status !== 200 ) {
51+ if ( res ?. status === 200 ) {
52+ setNoti ( ( curNoti ) =>
53+ curNoti . map ( ( noti ) => {
54+ if ( noti . timelineId === timelineId ) {
55+ return { ...noti , read : true } ;
56+ }
57+ return noti ;
58+ } ) ,
59+ ) ;
60+ } else {
5261 console . log ( '읽음처리 에러 발생' ) ;
5362 }
5463 } ;
You can’t perform that action at this time.
0 commit comments