From dbc2496b8f42323333582e1fd9cf4ab46830db54 Mon Sep 17 00:00:00 2001 From: SeanM322 Date: Tue, 15 Oct 2024 14:39:51 +0300 Subject: [PATCH] add loader for next page in CollectionPage --- .../MockUpPage/NftList/NftData/NftCollectionPage.tsx | 5 +++-- rair-front/src/redux/tokenSlice.ts | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/rair-front/src/components/MockUpPage/NftList/NftData/NftCollectionPage.tsx b/rair-front/src/components/MockUpPage/NftList/NftData/NftCollectionPage.tsx index 8644f28b..c85a3f60 100644 --- a/rair-front/src/components/MockUpPage/NftList/NftData/NftCollectionPage.tsx +++ b/rair-front/src/components/MockUpPage/NftList/NftData/NftCollectionPage.tsx @@ -70,7 +70,8 @@ const NftCollectionPageComponent: FC = ({ currentCollection, currentCollectionTotal, currentCollectionStatus, - currentCollectionMetadata + currentCollectionMetadata, + currentCollectionNextPageStatus } = useAppSelector((store) => store.tokens); const { width } = useWindowDimensions(); @@ -781,7 +782,7 @@ const NftCollectionPageComponent: FC = ({ )} - {isLoading && ( + {currentCollectionNextPageStatus && (
{ + state.currentCollectionNextPageStatus = true; + }) + .addCase( loadNextCollectionPage.fulfilled, (state, action: PayloadAction) => { @@ -368,10 +375,15 @@ export const tokenSlice = createSlice({ state.currentCollection[token.uniqueIndexInContract.toString()] = token; }); + state.currentCollectionNextPageStatus = false; } } ) + .addCase(loadNextCollectionPage.rejected, (state) => { + state.currentCollectionNextPageStatus = false; + }) + // Load metadata for collection .addCase(loadCollectionMetadata.pending, (state) => { state.currentCollectionMetadataStatus = dataStatuses.Loading;