diff --git a/composables/api.ts b/composables/api.ts index 603f71f..d2ca7a0 100644 --- a/composables/api.ts +++ b/composables/api.ts @@ -1,4 +1,4 @@ -import type { ChannelResponse, GuildMemberResponse, GuildResponse, MessageResponse } from "~/types/interfaces"; +import type { ChannelResponse, GuildMemberResponse, GuildResponse, MessageResponse, StatsResponse } from "~/types/interfaces"; export const useApi = () => { async function fetchGuilds(): Promise { @@ -41,6 +41,15 @@ export const useApi = () => { return await fetchWithApi(`/channels/${channelId}/messages/${messageId}`); } + async function fetchInstanceStats(apiBase: string): Promise { + return await $fetch(`${apiBase}/stats`, { method: "GET" }); + } + + async function sendVerificationEmail(): Promise { + const email = useAuth().user.value?.email; + await fetchWithApi("/auth/verify-email", { method: "POST", body: { email } }); + } + return { fetchGuilds, fetchGuild, @@ -51,6 +60,8 @@ export const useApi = () => { fetchUsers, fetchUser, fetchMessages, - fetchMessage + fetchMessage, + fetchInstanceStats, + sendVerificationEmail } }