Skip to content

Commit

Permalink
refactor: 설문마감,전송 후 모달 닫히게 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
khj0426 committed Dec 4, 2023
1 parent a3dcf3c commit 7d2c0cb
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/pages/CreatedReviewManagePage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//생성한 리뷰 관리 페이지

import { AxiosError } from 'axios'
import { Suspense, useState } from 'react'
import { Suspense, useState, useRef } from 'react'
import { useLocation } from 'react-router-dom'
import { useToast } from '@/hooks'
import { Header, Modal, ReviewInfo } from '@/components'
Expand Down Expand Up @@ -40,9 +40,12 @@ const CreatedReviewManagePage = () => {
})

const { mutate: closeReview } = useCloseSurvey({ id: reviewId })
const closeReviewRef = useRef<HTMLLabelElement | null>(null)
const sendReviewRef = useRef<HTMLLabelElement | null>(null)

const { mutate: sendReview } = useSendReview({ reviewId })
const handleClickSurveyClose = () => {
closeReviewRef?.current?.click()
closeReview(undefined, {
onSuccess: () => {
addToast({
Expand All @@ -68,6 +71,8 @@ const CreatedReviewManagePage = () => {
return
}

sendReviewRef?.current?.click()

sendReview(undefined, {
onSuccess: ({ data }) => {
if (data.errorCode && data.message) {
Expand Down Expand Up @@ -144,7 +149,11 @@ const CreatedReviewManagePage = () => {
className={`btn fixed bottom-10 cursor-pointer self-end rounded-md bg-active-orange text-white dark:text-black
`}
>
<label htmlFor="close-review" className="cursor-pointer">
<label
htmlFor="close-review"
className="cursor-pointer"
ref={closeReviewRef}
>
설문 마감
</label>
</button>
Expand All @@ -156,7 +165,11 @@ const CreatedReviewManagePage = () => {
`}
disabled={!checkAllReceiverReceived?.success}
>
<label htmlFor="send-review" className="cursor-pointer">
<label
htmlFor="send-review"
className="cursor-pointer"
ref={sendReviewRef}
>
전송
</label>
</button>
Expand Down

0 comments on commit 7d2c0cb

Please sign in to comment.