added duplication support
This commit is contained in:
@@ -284,26 +284,51 @@ const handleView = (item: Event): void => {
|
|||||||
* @param item
|
* @param item
|
||||||
*/
|
*/
|
||||||
const handleDuplicate = async (item: Event): Promise<void> => {
|
const handleDuplicate = async (item: Event): Promise<void> => {
|
||||||
// try {
|
try {
|
||||||
// let result = await api.post({
|
let data = {
|
||||||
// url: "/events",
|
title: `Copy of ${item.title}`,
|
||||||
// body: item,
|
location: item.location,
|
||||||
// });
|
location_url: item.location_url,
|
||||||
// toastStore.addToast({
|
address: item.address,
|
||||||
// title: "Event Duplicated",
|
start_at: new SMDate(item.start_at, {
|
||||||
// content:
|
format: "dmy",
|
||||||
// "The event has been duplicated.",
|
}).format("yyyy/MM/dd HH:mm:ss", { utc: true }),
|
||||||
// type: "success",
|
end_at: new SMDate(item.end_at, {
|
||||||
// });
|
format: "dmy",
|
||||||
// router.push({ name: "dashboard-event-edit", params: { id: result.id } });
|
}).format("yyyy/MM/dd HH:mm:ss", { utc: true }),
|
||||||
// } catch {
|
status: item.status,
|
||||||
// toastStore.addToast({
|
publish_at:
|
||||||
// title: "Server Error",
|
item.publish_at == ""
|
||||||
// content:
|
? ""
|
||||||
// "An error occurred duplicating the event.",
|
: new SMDate(item.publish_at, {
|
||||||
// type: "danger",
|
format: "dmy",
|
||||||
// });
|
}).format("yyyy/MM/dd HH:mm:ss", { utc: true }),
|
||||||
// }
|
registration_type: item.registration_type,
|
||||||
|
registration_data: item.registration_data,
|
||||||
|
content: item.content,
|
||||||
|
hero: item.hero.id,
|
||||||
|
price: item.price,
|
||||||
|
ages: item.ages,
|
||||||
|
attachments: item.attachments.map((item) => item.id),
|
||||||
|
};
|
||||||
|
|
||||||
|
await api.post({
|
||||||
|
url: "/events",
|
||||||
|
body: data,
|
||||||
|
});
|
||||||
|
|
||||||
|
useToastStore().addToast({
|
||||||
|
title: "Event Duplicated",
|
||||||
|
content: "The event has been duplicated.",
|
||||||
|
type: "success",
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
useToastStore().addToast({
|
||||||
|
title: "Server error",
|
||||||
|
content: "An error occurred duplicating the event.",
|
||||||
|
type: "danger",
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user