import { Form, Formik } from "formik"; import type { HotlistUploadType } from "../../../types/types"; import { useSystemConfig } from "../../../hooks/useSystemConfig"; import { CAM_BASE } from "../../../utils/config"; const NPEDHotlist = () => { const { uploadSettings } = useSystemConfig(); const initialValue = { file: null, }; const handleSubmit = (values: HotlistUploadType) => { const settings = { file: values.file, opts: { timeoutMs: 30000, fieldName: "upload", uploadUrl: `${CAM_BASE}/upload/hotlist-upload/2`, }, }; uploadSettings(settings); }; return ( {({ setFieldValue, setErrors, errors }) => { return (
{ if (e.target.files) { if (e.target.files[0].type !== "text/csv") { setErrors({ file: "This file is not a CSV, please select a different one", }); } setFieldValue("file", e.target.files[0]); } else { setErrors({ file: "no file" }); } }} />

{errors.file && errors.file}

); }}
); }; export default NPEDHotlist;