Adding create reminder API
This commit is contained in:
15
src/api.ts
15
src/api.ts
@ -122,8 +122,11 @@ export const fetchGuildReminders = (guild: string) => ({
|
||||
.then((value) =>
|
||||
value.map((reminder) => ({
|
||||
...reminder,
|
||||
utc_time: DateTime.fromISO(reminder.utc_time),
|
||||
expires: reminder.expires === null ? null : DateTime.fromISO(reminder.expires),
|
||||
utc_time: DateTime.fromISO(reminder.utc_time, { zone: "UTC" }),
|
||||
expires:
|
||||
reminder.expires === null
|
||||
? null
|
||||
: DateTime.fromISO(reminder.expires, { zone: "UTC" }),
|
||||
})),
|
||||
) as Promise<Reminder[]>,
|
||||
staleTime: OTHER_STALE_TIME,
|
||||
@ -137,6 +140,14 @@ export const patchGuildReminder = (guild: string) => ({
|
||||
}),
|
||||
});
|
||||
|
||||
export const postGuildReminder = (guild: string) => ({
|
||||
mutationFn: (reminder: Reminder) =>
|
||||
axios.post(`/dashboard/api/guild/${guild}/reminders`, {
|
||||
...reminder,
|
||||
utc_time: reminder.utc_time.toFormat("yyyy-LL-dd'T'HH:mm:ss"),
|
||||
}),
|
||||
});
|
||||
|
||||
export const deleteGuildReminder = (guild: string) => ({
|
||||
mutationFn: (reminder: Reminder) =>
|
||||
axios.delete(`/dashboard/api/guild/${guild}/reminders`, {
|
||||
|
Reference in New Issue
Block a user