fix last comments request

This commit is contained in:
Pavel Mineev
2021-02-02 15:53:40 -06:00
committed by Umputun
parent 8572f809cc
commit 4d075f4f7a
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -2,5 +2,5 @@ import { Comment } from './types';
import { apiFetcher } from './fetcher';
export default function getLastComments(siteId: string, max: number): Promise<Comment[]> {
return apiFetcher.get(`/last/${max}?site=${siteId}`);
return apiFetcher.get(`/last/${max}`, { site: siteId });
}
+1 -1
View File
@@ -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<string, string> = {};
const params: RequestInit = { method };