UNPKG

dynamic-modal

Version:

The dynamic-modal is a solution of creation different modals into project using a json configuration file

20 lines (19 loc) 651 B
'use client'; export const liveDataAction = async (fieldData, formData, action) => { if (typeof fieldData === 'string' || typeof fieldData === 'number' || typeof fieldData === 'boolean') { const options = await action(String(fieldData), formData); return options ?? []; } return []; }; export const liveDataHandler = async (fieldData, formData, action) => { if (typeof fieldData === 'string' || typeof fieldData === 'number' || typeof fieldData === 'boolean') { const result = await action(String(fieldData), formData); return result ?? false; } return false; };