Load/create/delete templates

This commit is contained in:
jude
2023-11-06 18:11:18 +00:00
parent 8ba7a39ce5
commit 5dde422ee5
3 changed files with 107 additions and 11 deletions

View File

@ -178,3 +178,22 @@ export const fetchGuildTemplates = (guild: string) => ({
>,
staleTime: OTHER_STALE_TIME,
});
export const postGuildTemplate = (guild: string) => ({
mutationFn: (reminder: Reminder) =>
axios
.post(`/dashboard/api/guild/${guild}/templates`, {
...reminder,
utc_time: reminder.utc_time.toFormat("yyyy-LL-dd'T'HH:mm:ss"),
})
.then((resp) => resp.data),
});
export const deleteGuildTemplate = (guild: string) => ({
mutationFn: (template: Template) =>
axios.delete(`/dashboard/api/guild/${guild}/templates`, {
data: {
id: template.id,
},
}),
});