Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
74865df3ba
@ -5,6 +5,7 @@ import { getIronSession } from 'iron-session'
|
|||||||
import { sessionOptions } from '@/libs/session'
|
import { sessionOptions } from '@/libs/session'
|
||||||
import { cookies } from 'next/headers'
|
import { cookies } from 'next/headers'
|
||||||
import type { SessionData } from '@/types/Auth'
|
import type { SessionData } from '@/types/Auth'
|
||||||
|
import { Prisma } from '@prisma/client'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 조사 매물 조회 에러 메시지
|
* @description 조사 매물 조회 에러 메시지
|
||||||
@ -278,7 +279,7 @@ export async function DELETE(request: NextRequest, { params }: { params: Promise
|
|||||||
try {
|
try {
|
||||||
const { id } = await params
|
const { id } = await params
|
||||||
|
|
||||||
await prisma.$transaction(async (tx) => {
|
await prisma.$transaction(async (tx: Prisma.TransactionClient) => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const detailData = await tx.SD_SURVEY_SALES_BASIC_INFO.findUnique({
|
const detailData = await tx.SD_SURVEY_SALES_BASIC_INFO.findUnique({
|
||||||
where: { ID: Number(id) },
|
where: { ID: Number(id) },
|
||||||
|
|||||||
@ -146,6 +146,9 @@ export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
|
|||||||
})
|
})
|
||||||
if (!isUpdatingSurvey) {
|
if (!isUpdatingSurvey) {
|
||||||
setMode('READ')
|
setMode('READ')
|
||||||
|
if (isSubmitProcess) {
|
||||||
|
popupController.setSurveySaleSubmitPopup(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/** 제출 로직인 경우 search param 추가 */
|
/** 제출 로직인 경우 search param 추가 */
|
||||||
@ -249,7 +252,7 @@ export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Button Components
|
/** Button Components */
|
||||||
const ListButton = () => {
|
const ListButton = () => {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -97,11 +97,11 @@ export default function DetailForm() {
|
|||||||
/** 제출 팝업 처리 - createSurvey 이후 popup 처리 시 노드 삽입 오류로 인해 별도 처리 */
|
/** 제출 팝업 처리 - createSurvey 이후 popup 처리 시 노드 삽입 오류로 인해 별도 처리 */
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const show = searchParams.get('show')
|
const show = searchParams.get('show')
|
||||||
if (show === 'true') {
|
if (show === 'true' && !isLoadingSurveyDetail) {
|
||||||
popupController.setSurveySaleSubmitPopup(true)
|
popupController.setSurveySaleSubmitPopup(true)
|
||||||
router.replace(pathname)
|
router.replace(pathname)
|
||||||
}
|
}
|
||||||
}, [searchParams, pathname])
|
}, [searchParams, pathname, isLoadingSurveyDetail])
|
||||||
|
|
||||||
/** 세션 데이터가 변경될 때 기본 정보 업데이트 */
|
/** 세션 데이터가 변경될 때 기본 정보 업데이트 */
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@ -110,19 +110,19 @@ export function useSurvey(
|
|||||||
const status = error.response?.status
|
const status = error.response?.status
|
||||||
alert(error.response?.data.error)
|
alert(error.response?.data.error)
|
||||||
switch (status) {
|
switch (status) {
|
||||||
// session 없는 경우
|
/** session 없는 경우 */
|
||||||
case 401:
|
case 401:
|
||||||
router.replace('/login')
|
router.replace('/login')
|
||||||
break
|
break
|
||||||
// 조회 권한 없는 경우
|
/** 조회 권한 없는 경우 */
|
||||||
case 403:
|
case 403:
|
||||||
router.replace('/survey-sale')
|
router.replace('/survey-sale')
|
||||||
break
|
break
|
||||||
// 데이터 DB상 존재하지 않는 경우
|
/** 데이터 DB상 존재하지 않는 경우 */
|
||||||
case 404:
|
case 404:
|
||||||
router.replace('/survey-sale')
|
router.replace('/survey-sale')
|
||||||
break
|
break
|
||||||
// 서버 오류
|
/** 서버 오류 */
|
||||||
case 500:
|
case 500:
|
||||||
router.back()
|
router.back()
|
||||||
break
|
break
|
||||||
@ -268,8 +268,8 @@ export function useSurvey(
|
|||||||
* @throws {Error} id가 없는 경우 에러 발생
|
* @throws {Error} id가 없는 경우 에러 발생
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* // 삭제 성공 시 목록 데이터만 갱신하고, 상세 데이터는 갱신하지 않음
|
*
|
||||||
* // 상세 데이터를 갱신하면 404 에러가 발생할 수 있음
|
*
|
||||||
*/
|
*/
|
||||||
const { mutateAsync: deleteSurvey, isPending: isDeletingSurvey } = useMutation({
|
const { mutateAsync: deleteSurvey, isPending: isDeletingSurvey } = useMutation({
|
||||||
mutationFn: async () => {
|
mutationFn: async () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user