Sort members list #45

Merged
twig merged 11 commits from sort-members-list into main 2025-07-18 05:34:44 +00:00
2 changed files with 7 additions and 2 deletions
Showing only changes of commit ea1f032ffc - Show all commits

View file

@ -17,6 +17,10 @@ export const useApi = () => {
return await fetchWithApi(`/guilds/${guildId}`);
}
async function fetchMyGuilds(): Promise<GuildResponse[]> {
return ensureIsArray(await fetchWithApi(`/me/guilds`));
}
async function fetchChannels(guildId: string): Promise<ChannelResponse[]> {
return ensureIsArray(await fetchWithApi(`/guilds/${guildId}/channels`));
}
@ -85,6 +89,7 @@ export const useApi = () => {
return {
fetchGuilds,
fetchGuild,
fetchMyGuilds,
fetchChannels,
fetchChannel,
fetchMembers,

View file

@ -95,7 +95,7 @@ const options = [
if (invite.length == 6) {
try {
const joinedGuild = await api.joinGuild(invite);
guilds?.push(joinedGuild);
guilds.push(joinedGuild);
return await navigateTo(`/servers/${joinedGuild.uuid}`);
} catch (error) {
alert(`Couldn't use invite: ${error}`);
@ -151,7 +151,7 @@ const options = [
}
];
const guilds: GuildResponse[] | undefined = await fetchWithApi("/me/guilds");
const guilds = await api.fetchMyGuilds();
function createDropdown() {
const dropdown = h(GuildDropdown, { options });