Message flash provider

Allows errors to be displayed neatly in ephemeral boxes at bottom of screen
This commit is contained in:
jude
2023-11-05 13:45:04 +00:00
parent f310bbef54
commit 30dfaa17af
11 changed files with 131 additions and 31 deletions

View File

@@ -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) => ({