From febdbb942189f1a666de9641c96d1f38c0d85549 Mon Sep 17 00:00:00 2001 From: SauceyRed Date: Sun, 1 Jun 2025 01:00:57 +0200 Subject: [PATCH] feat: add query parameters options to fetchMessages function --- composables/api.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/composables/api.ts b/composables/api.ts index c74f8f3..603f71f 100644 --- a/composables/api.ts +++ b/composables/api.ts @@ -17,7 +17,6 @@ export const useApi = () => { return await fetchWithApi(`/channels/${channelId}`) } - async function fetchMembers(guildId: string): Promise { return await fetchWithApi(`/guilds/${guildId}/members`); } @@ -34,8 +33,8 @@ export const useApi = () => { return await fetchWithApi(`/users/${userId}`); } - async function fetchMessages(channelId: string): Promise { - return await fetchWithApi(`/channels/${channelId}/messages`); + async function fetchMessages(channelId: string, options?: { amount?: number, offset?: number }): Promise { + return await fetchWithApi(`/channels/${channelId}/messages`, { query: { amount: options?.amount ?? 100, offset: options?.offset ?? 0 } }); } async function fetchMessage(channelId: string, messageId: string): Promise {