mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-07 16:19:01 +00:00
12 lines
408 B
TypeScript
12 lines
408 B
TypeScript
const MAX_DOCUMENT_BYTES = 10 * 1024 * 1024;
|
|
const ALLOWED_DOCUMENT_TYPES = new Set(["application/pdf", "image/jpeg", "image/png"]);
|
|
|
|
export function validateVendorDocument(file: File): string | undefined {
|
|
if (!ALLOWED_DOCUMENT_TYPES.has(file.type)) {
|
|
return "Only PDF, JPG, and PNG files are allowed.";
|
|
}
|
|
|
|
if (file.size > MAX_DOCUMENT_BYTES) {
|
|
return "Files must be 10 MB or smaller.";
|
|
}
|
|
}
|