docs: add description annotation at error handling function

This commit is contained in:
Dayoung 2025-06-18 10:48:50 +09:00
parent 12b9dd4216
commit b116e6e5c1

View File

@ -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> => {
try {
const resp = await func()
@ -422,13 +430,27 @@ export function useSurvey(
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) {
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)