diff --git a/src/hooks/useSurvey.ts b/src/hooks/useSurvey.ts index fb62253..345d4a4 100644 --- a/src/hooks/useSurvey.ts +++ b/src/hooks/useSurvey.ts @@ -140,6 +140,14 @@ export function useSurvey( } } + /** + * @description 조사 매물 try catch 처리 함수 + * + * @param {Function} func 조사 매물 API 함수 + * @param {boolean} isList 조사 매물 목록 여부 + * @param {boolean} isThrow 조사 매물 데이터 조회 에러 처리 여부 + * @returns {Promise} API 응답 데이터 + */ const tryFunction = async (func: () => Promise, isList?: boolean, isThrow?: boolean): Promise => { try { const resp = await func() @@ -422,13 +430,27 @@ export function useSurvey( return await tryFunction(() => axiosInstance(null).get(endpoint), false, true) } - const showSurveyAlert = (message: (typeof ALERT_MESSAGES)[keyof typeof ALERT_MESSAGES] | string, requiredField?: string) => { + /** + * @description 조사 매물 알림 메시지 출력 + * + * @param {string} message 알림 메시지 + * @param {string} [requiredField] 필수 필드 이름 + */ + const showSurveyAlert = (message: (typeof ALERT_MESSAGES)[keyof typeof ALERT_MESSAGES] | string, requiredField?: (typeof requiredFields)[number]['field']) => { if (requiredField) { alert(`${requiredField} ${message}`) } else { alert(message) } } + + /** + * @description 조사 매물 확인 메시지 출력 + * + * @param {string} message 확인 메시지 + * @param {Function} onConfirm 확인 함수 + * @param {Function} [onCancel] 취소 함수 + */ const showSurveyConfirm = (message: string, onConfirm: () => void, onCancel?: () => void) => { if (window.neoConfirm) { window.neoConfirm(message, onConfirm)