docs: add description annotation at error handling function
This commit is contained in:
parent
12b9dd4216
commit
b116e6e5c1
@ -140,6 +140,14 @@ export function useSurvey(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 조사 매물 try catch 처리 함수
|
||||||
|
*
|
||||||
|
* @param {Function} func 조사 매물 API 함수
|
||||||
|
* @param {boolean} isList 조사 매물 목록 여부
|
||||||
|
* @param {boolean} isThrow 조사 매물 데이터 조회 에러 처리 여부
|
||||||
|
* @returns {Promise<any>} API 응답 데이터
|
||||||
|
*/
|
||||||
const tryFunction = async (func: () => Promise<any>, isList?: boolean, isThrow?: boolean): Promise<any> => {
|
const tryFunction = async (func: () => Promise<any>, isList?: boolean, isThrow?: boolean): Promise<any> => {
|
||||||
try {
|
try {
|
||||||
const resp = await func()
|
const resp = await func()
|
||||||
@ -422,13 +430,27 @@ export function useSurvey(
|
|||||||
return await tryFunction(() => axiosInstance(null).get<SubmitTargetResponse[]>(endpoint), false, true)
|
return await tryFunction(() => axiosInstance(null).get<SubmitTargetResponse[]>(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) {
|
if (requiredField) {
|
||||||
alert(`${requiredField} ${message}`)
|
alert(`${requiredField} ${message}`)
|
||||||
} else {
|
} else {
|
||||||
alert(message)
|
alert(message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 조사 매물 확인 메시지 출력
|
||||||
|
*
|
||||||
|
* @param {string} message 확인 메시지
|
||||||
|
* @param {Function} onConfirm 확인 함수
|
||||||
|
* @param {Function} [onCancel] 취소 함수
|
||||||
|
*/
|
||||||
const showSurveyConfirm = (message: string, onConfirm: () => void, onCancel?: () => void) => {
|
const showSurveyConfirm = (message: string, onConfirm: () => void, onCancel?: () => void) => {
|
||||||
if (window.neoConfirm) {
|
if (window.neoConfirm) {
|
||||||
window.neoConfirm(message, onConfirm)
|
window.neoConfirm(message, onConfirm)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user