mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
go to the last page if page doesn't exist
This commit is contained in:
parent
a92367510f
commit
8dbc3c09ee
@ -166,6 +166,22 @@ function ListView({
|
||||
data: { results, pagination: paginationResult },
|
||||
} = await fetchClient.get(endPoint, options);
|
||||
|
||||
// If user enters a page number that doesn't exist, redirect him to the last page
|
||||
if (paginationResult.page > paginationResult.pageCount && paginationResult.pageCount > 0) {
|
||||
const query = {
|
||||
...params,
|
||||
page: paginationResult.pageCount,
|
||||
};
|
||||
|
||||
push({
|
||||
pathname,
|
||||
state: { from: pathname },
|
||||
search: stringify(query),
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
notifyStatus(
|
||||
formatMessage(
|
||||
{
|
||||
@ -205,7 +221,17 @@ function ListView({
|
||||
});
|
||||
}
|
||||
},
|
||||
[formatMessage, getData, getDataSucceeded, notifyStatus, push, toggleNotification, fetchClient]
|
||||
[
|
||||
formatMessage,
|
||||
getData,
|
||||
getDataSucceeded,
|
||||
notifyStatus,
|
||||
push,
|
||||
toggleNotification,
|
||||
fetchClient,
|
||||
params,
|
||||
pathname,
|
||||
]
|
||||
);
|
||||
|
||||
const handleConfirmDeleteAllData = React.useCallback(
|
||||
|
Loading…
x
Reference in New Issue
Block a user