block non pdf upload

This commit is contained in:
Timur Ercan
2023-03-27 12:58:17 +02:00
parent 9945cfb2c7
commit e79a622ddd

View File

@ -6,7 +6,12 @@ export const uploadDocument = async (event: any) => {
if (event.target.files && event.target.files[0]) {
const body = new FormData();
const document = event.target.files[0];
const fileName = event.target.files[0].name;
const fileName: string = event.target.files[0].name;
if (!fileName.endsWith(".pdf")) {
toast.error("Non-PDF documents are not supported yet.");
return;
}
body.append("document", document || "");
const response: any = await toast
.promise(