mirror of
https://github.com/WDI-Ideas/rubix-admin-panel.git
synced 2026-04-28 21:25:50 +00:00
updated
This commit is contained in:
@@ -112,26 +112,26 @@ export const addNews = Yup.object().shape({
|
||||
}
|
||||
}
|
||||
)
|
||||
.test("file_formate", "Image file has unsupported format.", (files) => {
|
||||
// // console.log(files[0].type)
|
||||
// .test("file_formate", "Image file has unsupported format.", (files) => {
|
||||
// // // console.log(files[0].type)
|
||||
|
||||
const SUPPORTED_FORMATS = [
|
||||
"image/jpeg",
|
||||
"image/png",
|
||||
"image/gif",
|
||||
"image/tiff",
|
||||
"image/svg+xml",
|
||||
];
|
||||
try {
|
||||
if (files.length !== 0) {
|
||||
setPreviewImage(URL.createObjectURL(files[0]));
|
||||
return files && SUPPORTED_FORMATS.includes(files[0].type);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
// const SUPPORTED_FORMATS = [
|
||||
// "image/jpeg",
|
||||
// "image/png",
|
||||
// "image/gif",
|
||||
// "image/tiff",
|
||||
// "image/svg+xml",
|
||||
// ];
|
||||
// try {
|
||||
// if (files.length !== 0) {
|
||||
// setPreviewImage(URL.createObjectURL(files[0]));
|
||||
// return files && SUPPORTED_FORMATS.includes(files[0].type);
|
||||
// }
|
||||
// return true;
|
||||
// } catch (error) {
|
||||
// return false;
|
||||
// }
|
||||
// })
|
||||
.optional(),
|
||||
});
|
||||
|
||||
@@ -161,26 +161,26 @@ export const editNews = Yup.object().shape({
|
||||
}
|
||||
}
|
||||
)
|
||||
.test("file_formate", "Image file has unsupported format.", (files) => {
|
||||
// // console.log(files[0].type)
|
||||
// .test("file_formate", "Image file has unsupported format.", (files) => {
|
||||
// // // console.log(files[0].type)
|
||||
|
||||
const SUPPORTED_FORMATS = [
|
||||
"image/jpeg",
|
||||
"image/png",
|
||||
"image/gif",
|
||||
"image/tiff",
|
||||
"image/svg+xml",
|
||||
];
|
||||
try {
|
||||
if (files.length !== 0) {
|
||||
setPreviewImage(URL.createObjectURL(files[0]));
|
||||
return files && SUPPORTED_FORMATS.includes(files[0].type);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
// const SUPPORTED_FORMATS = [
|
||||
// "image/jpeg",
|
||||
// "image/png",
|
||||
// "image/gif",
|
||||
// "image/tiff",
|
||||
// "image/svg+xml",
|
||||
// ];
|
||||
// try {
|
||||
// if (files.length !== 0) {
|
||||
// setPreviewImage(URL.createObjectURL(files[0]));
|
||||
// return files && SUPPORTED_FORMATS.includes(files[0].type);
|
||||
// }
|
||||
// return true;
|
||||
// } catch (error) {
|
||||
// return false;
|
||||
// }
|
||||
// })
|
||||
.optional(),
|
||||
});
|
||||
|
||||
@@ -213,26 +213,26 @@ export const addEvents = Yup.object().shape({
|
||||
}
|
||||
}
|
||||
)
|
||||
.test("file_formate", "Image file has unsupported format.", (files) => {
|
||||
// // console.log(files[0].type)
|
||||
// .test("file_formate", "Image file has unsupported format.", (files) => {
|
||||
// // // console.log(files[0].type)
|
||||
|
||||
const SUPPORTED_FORMATS = [
|
||||
"image/jpeg",
|
||||
"image/png",
|
||||
"image/gif",
|
||||
"image/tiff",
|
||||
"image/svg+xml",
|
||||
];
|
||||
try {
|
||||
if (files.length !== 0) {
|
||||
setPreviewImage(URL.createObjectURL(files[0]));
|
||||
return files && SUPPORTED_FORMATS.includes(files[0].type);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
// const SUPPORTED_FORMATS = [
|
||||
// "image/jpeg",
|
||||
// "image/png",
|
||||
// "image/gif",
|
||||
// "image/tiff",
|
||||
// "image/svg+xml",
|
||||
// ];
|
||||
// try {
|
||||
// if (files.length !== 0) {
|
||||
// setPreviewImage(URL.createObjectURL(files[0]));
|
||||
// return files && SUPPORTED_FORMATS.includes(files[0].type);
|
||||
// }
|
||||
// return true;
|
||||
// } catch (error) {
|
||||
// return false;
|
||||
// }
|
||||
// })
|
||||
.optional(),
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user