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("id", String(data?.id));
|
||||||
form.setValue("title", String(data?.name));
|
form.setValue("title", String(data?.name));
|
||||||
form.setValue("description", String(data?.description));
|
form.setValue("description", String(data?.description));
|
||||||
form.setValue("contentType", data?.mediaTypes?.split(","));
|
form.setValue("contentType", data?.mediaTypes?.split(",") || []);
|
||||||
form.setValue(
|
form.setValue(
|
||||||
"selectedUser",
|
"selectedUser",
|
||||||
removeAndReturn(data?.publishedFor, [2, 3, 4])
|
removeAndReturn(data?.publishedFor, [2, 3, 4])
|
||||||
);
|
);
|
||||||
form.setValue("publishTo", data?.publishedLocation?.split(","));
|
form.setValue("publishTo", data?.publishedLocation?.split(",") || []);
|
||||||
form.setValue("file", thumbnailLink);
|
form.setValue("file", thumbnailLink);
|
||||||
|
|
||||||
setUnitData(filterString(data?.publishedLocationLevel, "under"));
|
setUnitData(filterString(data?.publishedLocationLevel, "under"));
|
||||||
|
|
|
||||||
|
|
@ -301,7 +301,7 @@ export default function DetailDaily() {
|
||||||
const handleItemCheckedChange = (id: string, checked: boolean | string) => {
|
const handleItemCheckedChange = (id: string, checked: boolean | string) => {
|
||||||
form.setValue(
|
form.setValue(
|
||||||
"output",
|
"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) => {
|
const handleUnitCheckedChange = (id: string, checked: boolean | string) => {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
form.setValue("unit", [...unit, id]);
|
form.setValue("unit", [...(unit ?? []), id]);
|
||||||
} else {
|
} else {
|
||||||
if (id == "2") {
|
if (id == "2") {
|
||||||
const temp = [];
|
const temp = [];
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,7 @@ export default function EditDaily() {
|
||||||
const handleItemCheckedChange = (id: string, checked: boolean | string) => {
|
const handleItemCheckedChange = (id: string, checked: boolean | string) => {
|
||||||
form.setValue(
|
form.setValue(
|
||||||
"output",
|
"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) => {
|
const handleUnitCheckedChange = (id: string, checked: boolean | string) => {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
form.setValue("unit", [...unit, id]);
|
form.setValue("unit", [...(unit ?? []), id]);
|
||||||
} else {
|
} else {
|
||||||
if (id == "2") {
|
if (id == "2") {
|
||||||
const temp = [];
|
const temp = [];
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,7 @@ export default function CreateDaily() {
|
||||||
const handleItemCheckedChange = (id: string, checked: boolean | string) => {
|
const handleItemCheckedChange = (id: string, checked: boolean | string) => {
|
||||||
form.setValue(
|
form.setValue(
|
||||||
"output",
|
"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) => {
|
const handleUnitCheckedChange = (id: string, checked: boolean | string) => {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
form.setValue("unit", [...unit, id]);
|
form.setValue("unit", [...(unit ?? []), id]);
|
||||||
} else {
|
} else {
|
||||||
if (id == "2") {
|
if (id == "2") {
|
||||||
const temp = [];
|
const temp = [];
|
||||||
|
|
|
||||||
|
|
@ -301,7 +301,7 @@ export default function DetailDaily() {
|
||||||
const handleItemCheckedChange = (id: string, checked: boolean | string) => {
|
const handleItemCheckedChange = (id: string, checked: boolean | string) => {
|
||||||
form.setValue(
|
form.setValue(
|
||||||
"output",
|
"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) => {
|
const handleItemCheckedChange = (id: string, checked: boolean | string) => {
|
||||||
form.setValue(
|
form.setValue(
|
||||||
"output",
|
"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) => {
|
const handleUnitCheckedChange = (id: string, checked: boolean | string) => {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
form.setValue("unit", [...unit, id]);
|
form.setValue("unit", [...(unit ?? []), id]);
|
||||||
} else {
|
} else {
|
||||||
if (id == "2") {
|
if (id == "2") {
|
||||||
const temp = [];
|
const temp = [];
|
||||||
|
|
|
||||||
|
|
@ -398,10 +398,8 @@ export default function CreateDaily() {
|
||||||
form.setValue(
|
form.setValue(
|
||||||
"output",
|
"output",
|
||||||
checked
|
checked
|
||||||
? [...output, item.id]
|
? [...(output ?? []), item.id]
|
||||||
: output.filter(
|
: (output ?? []).filter((value) => value !== item.id)
|
||||||
(value) => value !== item.id
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
@ -470,10 +468,8 @@ export default function CreateDaily() {
|
||||||
form.setValue(
|
form.setValue(
|
||||||
"unit",
|
"unit",
|
||||||
checked
|
checked
|
||||||
? [...unit, item.id]
|
? [...(unit ?? []), item.id]
|
||||||
: unit.filter(
|
: (unit ?? []).filter((value) => value !== item.id)
|
||||||
(value) => value !== item.id
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
@ -648,8 +644,8 @@ export default function CreateDaily() {
|
||||||
form.setValue(
|
form.setValue(
|
||||||
"media",
|
"media",
|
||||||
checked
|
checked
|
||||||
? [...media, item.id]
|
? [...(media ?? []), item.id]
|
||||||
: media.filter(
|
: (media ?? []).filter(
|
||||||
(value) => value !== item.id
|
(value) => value !== item.id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue