fixing error
This commit is contained in:
parent
450c54db11
commit
2d6ef04f45
|
|
@ -146,12 +146,12 @@ export default function EditCategoryModal(props: {
|
|||
form.setValue("id", String(data?.id));
|
||||
form.setValue("title", String(data?.name));
|
||||
form.setValue("description", String(data?.description));
|
||||
form.setValue("contentType", data?.mediaTypes?.split(","));
|
||||
form.setValue("contentType", data?.mediaTypes?.split(",") || []);
|
||||
form.setValue(
|
||||
"selectedUser",
|
||||
removeAndReturn(data?.publishedFor, [2, 3, 4])
|
||||
);
|
||||
form.setValue("publishTo", data?.publishedLocation?.split(","));
|
||||
form.setValue("publishTo", data?.publishedLocation?.split(",") || []);
|
||||
form.setValue("file", thumbnailLink);
|
||||
|
||||
setUnitData(filterString(data?.publishedLocationLevel, "under"));
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ export default function DetailDaily() {
|
|||
const handleItemCheckedChange = (id: string, checked: boolean | string) => {
|
||||
form.setValue(
|
||||
"output",
|
||||
checked ? [...output, id] : output.filter((value) => value !== id)
|
||||
checked ? [...(output ?? []), id] : (output ?? []).filter((value) => value !== id)
|
||||
);
|
||||
};
|
||||
|
||||
|
|
@ -318,7 +318,7 @@ export default function DetailDaily() {
|
|||
|
||||
const handleUnitCheckedChange = (id: string, checked: boolean | string) => {
|
||||
if (checked) {
|
||||
form.setValue("unit", [...unit, id]);
|
||||
form.setValue("unit", [...(unit ?? []), id]);
|
||||
} else {
|
||||
if (id == "2") {
|
||||
const temp = [];
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ export default function EditDaily() {
|
|||
const handleItemCheckedChange = (id: string, checked: boolean | string) => {
|
||||
form.setValue(
|
||||
"output",
|
||||
checked ? [...output, id] : output.filter((value) => value !== id)
|
||||
checked ? [...(output ?? []), id] : (output ?? []).filter((value) => value !== id)
|
||||
);
|
||||
};
|
||||
|
||||
|
|
@ -331,7 +331,7 @@ export default function EditDaily() {
|
|||
|
||||
const handleUnitCheckedChange = (id: string, checked: boolean | string) => {
|
||||
if (checked) {
|
||||
form.setValue("unit", [...unit, id]);
|
||||
form.setValue("unit", [...(unit ?? []), id]);
|
||||
} else {
|
||||
if (id == "2") {
|
||||
const temp = [];
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ export default function CreateDaily() {
|
|||
const handleItemCheckedChange = (id: string, checked: boolean | string) => {
|
||||
form.setValue(
|
||||
"output",
|
||||
checked ? [...output, id] : output.filter((value) => value !== id)
|
||||
checked ? [...(output ?? []), id] : (output ?? []).filter((value) => value !== id)
|
||||
);
|
||||
};
|
||||
|
||||
|
|
@ -279,7 +279,7 @@ export default function CreateDaily() {
|
|||
|
||||
const handleUnitCheckedChange = (id: string, checked: boolean | string) => {
|
||||
if (checked) {
|
||||
form.setValue("unit", [...unit, id]);
|
||||
form.setValue("unit", [...(unit ?? []), id]);
|
||||
} else {
|
||||
if (id == "2") {
|
||||
const temp = [];
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ export default function DetailDaily() {
|
|||
const handleItemCheckedChange = (id: string, checked: boolean | string) => {
|
||||
form.setValue(
|
||||
"output",
|
||||
checked ? [...output, id] : output.filter((value) => value !== id)
|
||||
checked ? [...(output ?? []), id] : (output ?? []).filter((value) => value !== id)
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ export default function EditDaily() {
|
|||
const handleItemCheckedChange = (id: string, checked: boolean | string) => {
|
||||
form.setValue(
|
||||
"output",
|
||||
checked ? [...output, id] : output.filter((value) => value !== id)
|
||||
checked ? [...(output ?? []), id] : (output ?? []).filter((value) => value !== id)
|
||||
);
|
||||
};
|
||||
|
||||
|
|
@ -331,7 +331,7 @@ export default function EditDaily() {
|
|||
|
||||
const handleUnitCheckedChange = (id: string, checked: boolean | string) => {
|
||||
if (checked) {
|
||||
form.setValue("unit", [...unit, id]);
|
||||
form.setValue("unit", [...(unit ?? []), id]);
|
||||
} else {
|
||||
if (id == "2") {
|
||||
const temp = [];
|
||||
|
|
|
|||
|
|
@ -398,10 +398,8 @@ export default function CreateDaily() {
|
|||
form.setValue(
|
||||
"output",
|
||||
checked
|
||||
? [...output, item.id]
|
||||
: output.filter(
|
||||
(value) => value !== item.id
|
||||
)
|
||||
? [...(output ?? []), item.id]
|
||||
: (output ?? []).filter((value) => value !== item.id)
|
||||
);
|
||||
}}
|
||||
/>
|
||||
|
|
@ -470,10 +468,8 @@ export default function CreateDaily() {
|
|||
form.setValue(
|
||||
"unit",
|
||||
checked
|
||||
? [...unit, item.id]
|
||||
: unit.filter(
|
||||
(value) => value !== item.id
|
||||
)
|
||||
? [...(unit ?? []), item.id]
|
||||
: (unit ?? []).filter((value) => value !== item.id)
|
||||
);
|
||||
}}
|
||||
/>
|
||||
|
|
@ -648,8 +644,8 @@ export default function CreateDaily() {
|
|||
form.setValue(
|
||||
"media",
|
||||
checked
|
||||
? [...media, item.id]
|
||||
: media.filter(
|
||||
? [...(media ?? []), item.id]
|
||||
: (media ?? []).filter(
|
||||
(value) => value !== item.id
|
||||
)
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue