referral history search update

This commit is contained in:
Demid
2023-05-03 00:26:08 +03:00
parent a8f065ff5e
commit 3d915b7f66
3 changed files with 16 additions and 6 deletions

View File

@@ -65,9 +65,9 @@ class ReferralSystem {
});
getMyReferral = (myWalletAddress: string) =>
fetchWithValidation(`${this.apiUrl}/referer/view/link`, linkSchema, {
fetchWithValidation(`${this.apiUrl}/referral/view/link`, linkSchema, {
headers: {
'referer-address': myWalletAddress,
referral: myWalletAddress,
},
});
@@ -183,7 +183,13 @@ class ReferralSystem {
errorSchema
);
getAggregatedHistory = (refererAddress: string, chainId: SupportedChainId | undefined, itemPerPage: number, page: number) => {
getAggregatedHistory = (
refererAddress: string,
chainId: SupportedChainId | undefined,
types: string[] | undefined,
itemPerPage: number,
page: number
) => {
const queryParams: Record<string, string | number> = {
n_per_page: itemPerPage,
page,
@@ -194,6 +200,10 @@ class ReferralSystem {
queryParams['chain_id'] = chainId;
}
if (types !== undefined) {
queryParams['history_filter'] = encodeURIComponent(types.join(','));
}
const queryString = Object.entries(queryParams).map(([k, v]) => `${k}=${v}`).join('&')
return fetchWithValidation(