Fix time inputs
This commit is contained in:
@ -128,38 +128,20 @@ export const fetchGuildRoles = (guild: string) => ({
|
||||
export const fetchGuildReminders = (guild: string) => ({
|
||||
queryKey: ["GUILD_REMINDERS", guild],
|
||||
queryFn: () =>
|
||||
axios
|
||||
.get(`/dashboard/api/guild/${guild}/reminders`)
|
||||
.then((resp) => resp.data)
|
||||
.then((value) =>
|
||||
value.map((reminder) => ({
|
||||
...reminder,
|
||||
utc_time: DateTime.fromISO(reminder.utc_time, { zone: "UTC" }),
|
||||
expires:
|
||||
reminder.expires === null
|
||||
? null
|
||||
: DateTime.fromISO(reminder.expires, { zone: "UTC" }),
|
||||
})),
|
||||
) as Promise<Reminder[]>,
|
||||
axios.get(`/dashboard/api/guild/${guild}/reminders`).then((resp) => resp.data) as Promise<
|
||||
Reminder[]
|
||||
>,
|
||||
staleTime: OTHER_STALE_TIME,
|
||||
});
|
||||
|
||||
export const patchGuildReminder = (guild: string) => ({
|
||||
mutationFn: (reminder: Reminder) =>
|
||||
axios.patch(`/dashboard/api/guild/${guild}/reminders`, {
|
||||
...reminder,
|
||||
utc_time: reminder.utc_time.toFormat("yyyy-LL-dd'T'HH:mm:ss"),
|
||||
}),
|
||||
axios.patch(`/dashboard/api/guild/${guild}/reminders`, reminder),
|
||||
});
|
||||
|
||||
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"),
|
||||
})
|
||||
.then((resp) => resp.data),
|
||||
axios.post(`/dashboard/api/guild/${guild}/reminders`, reminder).then((resp) => resp.data),
|
||||
});
|
||||
|
||||
export const deleteGuildReminder = (guild: string) => ({
|
||||
@ -182,12 +164,7 @@ export const fetchGuildTemplates = (guild: string) => ({
|
||||
|
||||
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),
|
||||
axios.post(`/dashboard/api/guild/${guild}/templates`, reminder).then((resp) => resp.data),
|
||||
});
|
||||
|
||||
export const deleteGuildTemplate = (guild: string) => ({
|
||||
|
Reference in New Issue
Block a user