diff --git a/composables/api.ts b/composables/api.ts index 0db1296..0382cfb 100644 --- a/composables/api.ts +++ b/composables/api.ts @@ -45,6 +45,10 @@ export const useApi = () => { return await fetchWithApi(`/guilds`, { method: "POST", body: { name } }); } + async function joinGuild(invite: string): Promise { + return await fetchWithApi(`/invites/${invite}`, { method: "POST" }) as GuildResponse; + } + return { fetchGuilds, fetchGuild, @@ -57,5 +61,6 @@ export const useApi = () => { fetchMessages, fetchMessage, createGuild, + joinGuild, } }