Message flash provider
Allows errors to be displayed neatly in ephemeral boxes at bottom of screen
This commit is contained in:
20
src/api.ts
20
src/api.ts
@@ -9,8 +9,9 @@ type UserInfo = {
|
||||
};
|
||||
|
||||
export type GuildInfo = {
|
||||
id: string;
|
||||
patreon: boolean;
|
||||
name: string;
|
||||
error?: string;
|
||||
};
|
||||
|
||||
type EmbedField = {
|
||||
@@ -95,6 +96,13 @@ export const fetchUserGuilds = () => ({
|
||||
staleTime: USER_INFO_STALE_TIME,
|
||||
});
|
||||
|
||||
export const fetchGuildInfo = (guild: string) => ({
|
||||
queryKey: ["GUILD_INFO", guild],
|
||||
queryFn: () =>
|
||||
axios.get(`/dashboard/api/guild/${guild}`).then((resp) => resp.data) as Promise<GuildInfo>,
|
||||
staleTime: GUILD_INFO_STALE_TIME,
|
||||
});
|
||||
|
||||
export const fetchGuildChannels = (guild: string) => ({
|
||||
queryKey: ["GUILD_CHANNELS", guild],
|
||||
queryFn: () =>
|
||||
@@ -142,10 +150,12 @@ 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"),
|
||||
}),
|
||||
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),
|
||||
});
|
||||
|
||||
export const deleteGuildReminder = (guild: string) => ({
|
||||
|
||||
Reference in New Issue
Block a user