Sort members list #45
2 changed files with 7 additions and 2 deletions
|
@ -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,
|
||||
|
|
|
@ -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 });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue