Add modal for image picker

This commit is contained in:
jude
2023-11-03 19:17:16 +00:00
parent b83f1f2f31
commit 5dc7ceb8aa
8 changed files with 103 additions and 66 deletions

View File

@ -52,6 +52,11 @@ type ChannelInfo = {
name: string;
};
type RoleInfo = {
id: string;
name: string;
};
type Template = {
id: number;
name: string;
@ -72,15 +77,16 @@ type Template = {
embed_fields: EmbedField[] | null;
};
export function fetchUserInfo(): Promise<UserInfo> {
return axios.get("/dashboard/api/user").then((resp) => resp.data) as Promise<UserInfo>;
}
export const fetchUserInfo = () => ({
queryKey: ["USER_INFO"],
queryFn: () => axios.get("/dashboard/api/user").then((resp) => resp.data) as Promise<UserInfo>,
});
export function fetchUserGuilds(): Promise<GuildInfo[]> {
return axios.get("/dashboard/api/user/guilds").then((resp) => resp.data) as Promise<
GuildInfo[]
>;
}
export const fetchUserGuilds = () => ({
queryKey: ["USER_GUILDS"],
queryFn: () =>
axios.get("/dashboard/api/user/guilds").then((resp) => resp.data) as Promise<GuildInfo[]>,
});
export const fetchGuildReminders = (guild: string) => ({
queryKey: ["GUILD_REMINDERS", guild],
@ -106,6 +112,15 @@ export const fetchGuildChannels = (guild: string) => ({
staleTime: 300,
});
export const fetchGuildRoles = (guild: string) => ({
queryKey: ["GUILD_ROLES", guild],
queryFn: () =>
axios.get(`/dashboard/api/guild/${guild}/roles`).then((resp) => resp.data) as Promise<
RoleInfo[]
>,
staleTime: 300,
});
export const guildTemplatesQuery = (guild: string) => ({
queryKey: ["GUILD_TEMPLATES", guild],
queryFn: () =>