mirror of
https://github.com/WDI-Ideas/rubix-admin-panel.git
synced 2026-04-29 03:25:51 +00:00
usecase updated
This commit is contained in:
@@ -370,3 +370,57 @@ export const addVideos = Yup.object().shape({
|
||||
duration: Yup.string().required("LinkedIn is required"),
|
||||
embeddedCode: Yup.string().required("LinkedIn is required"),
|
||||
});
|
||||
|
||||
|
||||
|
||||
export const addUsecase = Yup.object().shape({
|
||||
title: Yup.string().required("Name is required"),
|
||||
meta_description: Yup.string().required("Description is required"),
|
||||
content: Yup.string(),
|
||||
banner_image: Yup
|
||||
.mixed()
|
||||
.required("Thumbnail is required")
|
||||
.test("required", "You need to provide a file", (files) => {
|
||||
// return file && file.size <-- u can use this if you don't want to allow empty files to be uploaded;
|
||||
if (files) return true;
|
||||
return false;
|
||||
})
|
||||
.test(
|
||||
"fileSize",
|
||||
" The maximum size of profile picture is 15MB.",
|
||||
(files) => {
|
||||
//if u want to allow only certain file sizes
|
||||
try {
|
||||
if (files.length !== 0) {
|
||||
return files[0].size <= 15000000;
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
),
|
||||
icon: Yup
|
||||
.mixed()
|
||||
.required("Icon is required")
|
||||
.test("required", "You need to provide a file", (files) => {
|
||||
if (files) return true;
|
||||
return false;
|
||||
})
|
||||
.test(
|
||||
"fileSize",
|
||||
" The maximum size of profile picture is 15MB.",
|
||||
(files) => {
|
||||
try {
|
||||
if (files.length !== 0) {
|
||||
return files[0].size <= 15000000;
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user