fix: normalize search pagination params to avoid [object Object]
This commit is contained in:
@@ -191,6 +191,10 @@ export const useTokensData = (openFluentNotification) => {
|
||||
|
||||
// Search tokens function
|
||||
const searchTokens = async (page = 1, size = pageSize) => {
|
||||
const normalizedPage = Number.isInteger(page) && page > 0 ? page : 1;
|
||||
const normalizedSize =
|
||||
Number.isInteger(size) && size > 0 ? size : pageSize;
|
||||
|
||||
const { searchKeyword, searchToken } = getFormValues();
|
||||
if (searchKeyword === '' && searchToken === '') {
|
||||
setSearchMode(false);
|
||||
@@ -199,7 +203,7 @@ export const useTokensData = (openFluentNotification) => {
|
||||
}
|
||||
setSearching(true);
|
||||
const res = await API.get(
|
||||
`/api/token/search?keyword=${encodeURIComponent(searchKeyword)}&token=${encodeURIComponent(searchToken)}&p=${page}&size=${size}`,
|
||||
`/api/token/search?keyword=${encodeURIComponent(searchKeyword)}&token=${encodeURIComponent(searchToken)}&p=${normalizedPage}&size=${normalizedSize}`,
|
||||
);
|
||||
const { success, message, data } = res.data;
|
||||
if (success) {
|
||||
|
||||
Reference in New Issue
Block a user