fix date query parameter

This commit is contained in:
Sebastian 2023-08-07 06:51:26 -03:00
parent 7d1621767c
commit 9f776d3fb0
No known key found for this signature in database
GPG Key ID: 173909D1A5F66069

View File

@ -239,16 +239,16 @@ export function useBackendInstanceRequest(): useBackendInstanceRequestType {
searchDate?: Date, searchDate?: Date,
delta?: number, delta?: number,
): Promise<HttpResponseOk<T>> { ): Promise<HttpResponseOk<T>> {
const date_ms = const date_s =
delta && delta < 0 && searchDate delta && delta < 0 && searchDate
? searchDate.getTime() + 1 ? (searchDate.getTime() / 1000) + 1
: searchDate?.getTime(); : searchDate !== undefined ? (searchDate.getTime() / 1000) : undefined;
const params: any = {}; const params: any = {};
if (paid !== undefined) params.paid = paid; if (paid !== undefined) params.paid = paid;
if (delta !== undefined) params.delta = delta; if (delta !== undefined) params.delta = delta;
if (refunded !== undefined) params.refunded = refunded; if (refunded !== undefined) params.refunded = refunded;
if (wired !== undefined) params.wired = wired; if (wired !== undefined) params.wired = wired;
if (date_ms !== undefined) params.date_ms = date_ms; if (date_s !== undefined) params.date_s = date_s;
return requestHandler<T>(baseUrl, endpoint, { params, token }); return requestHandler<T>(baseUrl, endpoint, { params, token });
}, },
[baseUrl, token], [baseUrl, token],