diff --git a/frontend/app/common/api.getLastComments.ts b/frontend/app/common/api.getLastComments.ts index 26044075..305619a7 100644 --- a/frontend/app/common/api.getLastComments.ts +++ b/frontend/app/common/api.getLastComments.ts @@ -2,5 +2,5 @@ import { Comment } from './types'; import { apiFetcher } from './fetcher'; export default function getLastComments(siteId: string, max: number): Promise { - return apiFetcher.get(`/last/${max}?site=${siteId}`); + return apiFetcher.get(`/last/${max}`, { site: siteId }); } diff --git a/frontend/app/common/fetcher.ts b/frontend/app/common/fetcher.ts index 0fcd3af2..c5e5378c 100644 --- a/frontend/app/common/fetcher.ts +++ b/frontend/app/common/fetcher.ts @@ -32,7 +32,7 @@ const createFetcher = (baseUrl: string = '') => * @body - data for sending to the server. If you pass object it will be stringified. If you pass form data it will be sent as is. Content type headers will be added automatically. */ acc[method] = async (uri: string, query: QueryParams = {}, body?: Payload) => { - const queryString = new URLSearchParams({ ...query, site: siteId }); + const queryString = new URLSearchParams({ site: siteId, ...query }); const url = `${baseUrl}${uri}?${queryString}`; const headers: Record = {}; const params: RequestInit = { method };