From 5c178f99ae2d9321145c21f9886fcfe0824d73f6 Mon Sep 17 00:00:00 2001 From: SauceyRed Date: Wed, 9 Jul 2025 07:19:40 +0200 Subject: [PATCH] feat: add fetchInstanceStats and sendVerificationEmail to api composable --- composables/api.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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 } }