Add create todo under each channel

Sort channels for consistency
This commit is contained in:
2024-04-11 15:31:27 +01:00
parent 5406e6b8ec
commit 5e99a6f9de
3 changed files with 20 additions and 32 deletions

View File

@ -129,9 +129,13 @@ export const fetchGuildInfo = (guild: string) => ({
export const fetchGuildChannels = (guild: string) => ({
queryKey: ["GUILD_CHANNELS", guild],
queryFn: () =>
axios.get(`/dashboard/api/guild/${guild}/channels`).then((resp) => resp.data) as Promise<
ChannelInfo[]
>,
axios
.get(`/dashboard/api/guild/${guild}/channels`)
.then((resp) =>
resp.data.sort((a: ChannelInfo, b: ChannelInfo) =>
a.name == b.name ? 0 : a.name > b.name ? 1 : -1,
),
) as Promise<ChannelInfo[]>,
staleTime: GUILD_INFO_STALE_TIME,
});