Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | import { InputType, InputTypes } from "../../../../types/inputs/inputTypes.ts"; import { updateCardById } from "../../../../utils/execution/updateCardById.ts"; function handleChangeInput( type: InputType, key: string, currentTaskId: string, removeErrors: (key: string) => void, handleChange?: Function, ) { const handleChangeFunction = (val: string) => { if (handleChange) { handleChange(val); } else { updateCardById(key, val, currentTaskId); } removeErrors(key); }; const handleCompositeChange = (value: string) => { const valArr = JSON.parse(value); if (handleChange) { handleChange(valArr); } else { updateCardById(key, valArr, currentTaskId); } removeErrors(key); }; switch (type) { case InputTypes.TEXT: case InputTypes.MULTILINE: case InputTypes.DROPDOWN: case InputTypes.WYISWYG: case InputTypes.DATE: case InputTypes.TYPING_DROPDOWN: case InputTypes.TYPING_DROPDOWN_MULTIPLE: return handleChangeFunction; case InputTypes.COMPOSITE: case InputTypes.STRING_ARRAY: return handleCompositeChange; default: return () => null; } } export default handleChangeInput; |