refactor: update accepted file types for CSV uploads in import form and schema
This commit is contained in:
@@ -69,7 +69,7 @@ export default function ImportForm({
|
||||
</label>
|
||||
<input
|
||||
type="file"
|
||||
accept=".csv"
|
||||
accept="text/csv, text/comma-separated-values"
|
||||
onChange={handleFileChange}
|
||||
className="w-full rounded-lg border px-4 py-2"
|
||||
/>
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import { z } from "zod"
|
||||
|
||||
const ACCEPTED_MIME_TYPES = ["text/csv", "text/comma-separated-values"]
|
||||
|
||||
export const importSchema = z.object({
|
||||
file: z.instanceof(File).refine((file) => file.type === "text/csv", {
|
||||
message: "File must be a CSV",
|
||||
}),
|
||||
file: z
|
||||
.instanceof(File)
|
||||
.refine((file) => ACCEPTED_MIME_TYPES.includes(file.type), {
|
||||
message: "File must be a CSV",
|
||||
}),
|
||||
categoryId: z.string().optional(),
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user