Load/create/delete templates
This commit is contained in:
19
src/api.ts
19
src/api.ts
@ -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,
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
Reference in New Issue
Block a user