Add modal for image picker
This commit is contained in:
31
src/api.ts
31
src/api.ts
@ -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: () =>
|
||||
|
Reference in New Issue
Block a user