From 77fa155ba00fba4dc19e772f10d2684665757bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Lewandowski?= <35259896+pawellewandowski98@users.noreply.github.com> Date: Thu, 23 May 2024 15:32:36 +0200 Subject: [PATCH] feat(SPV-806): Adjust to new search contact method (#77) --- src/api/requests/contact.ts | 8 +++++--- src/api/requests/transaction.ts | 2 +- src/providers/contacts/provider.tsx | 11 +++++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/api/requests/contact.ts b/src/api/requests/contact.ts index cc81feb..e1ce542 100644 --- a/src/api/requests/contact.ts +++ b/src/api/requests/contact.ts @@ -1,10 +1,12 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ + import { PaginationParams } from '../types'; import { Contact, ContactMetadata } from '../types/contact'; import axios from 'axios'; -export const searchContacts = async (_pagination?: PaginationParams) => { - const { data: response } = await axios.get(`/contact/search`); +export const searchContacts = async (pagination?: PaginationParams) => { + const { data: response } = await axios.post(`/contact/search`, { + params: pagination + }); return response; }; diff --git a/src/api/requests/transaction.ts b/src/api/requests/transaction.ts index acaed5b..96b9c56 100644 --- a/src/api/requests/transaction.ts +++ b/src/api/requests/transaction.ts @@ -3,7 +3,7 @@ import { SendNewTransaction } from '@/api/types'; import { PaginationParams } from '../types/pagination'; export const getTransactions = async (pagination: PaginationParams) => { - const { data: response } = await axios.get(`/transaction`, { + const { data: response } = await axios.post(`/transaction/search`, { params: pagination, }); if (response != null && typeof response !== 'object') { diff --git a/src/providers/contacts/provider.tsx b/src/providers/contacts/provider.tsx index d83e12c..c1f3a78 100644 --- a/src/providers/contacts/provider.tsx +++ b/src/providers/contacts/provider.tsx @@ -1,5 +1,6 @@ import { searchContacts } from '@/api/requests/contact'; import { Contact } from '@/api/types/contact'; +import { PaginationParams } from '@/api/types'; import { usePikeEnabled } from '@/hooks/useFeatureFlags'; import { FC, PropsWithChildren, createContext, useCallback, useEffect, useMemo, useState } from 'react'; import { useAuthorization } from '../authorization'; @@ -26,8 +27,14 @@ export const ContactsProvider: FC = ({ children }) => { } setLoading(true); try { - const contacts = await searchContacts(); - setContacts(contacts); + const paginationParams : PaginationParams = { + page: 1, + page_size: 1000, + order: 'paymail', + sort: 'asc', + } + const contactsResponse = await searchContacts(paginationParams); + setContacts(contactsResponse.content); } catch { setContacts(null); setError(true);