diff --git a/src/pages/shared-albums/index.tsx b/src/pages/shared-albums/index.tsx index bd320ba9d..34249584c 100644 --- a/src/pages/shared-albums/index.tsx +++ b/src/pages/shared-albums/index.tsx @@ -43,6 +43,7 @@ export default function PublicCollectionGallery() { const url = useRef(null); const [publicFiles, setPublicFiles] = useState(null); const [publicCollection, setPublicCollection] = useState(null); + const [errorMessage, setErrorMessage] = useState(null); const appContext = useContext(AppContext); const [abuseReportFormView, setAbuseReportFormView] = useState(false); const [dialogMessage, setDialogMessage] = useState(); @@ -135,9 +136,11 @@ export default function PublicCollectionGallery() { setPublicCollection(collection); await syncPublicFiles(token.current, collection, setPublicFiles); + setErrorMessage(null); } catch (e) { const parsedError = parseSharingErrorCodes(e); if (parsedError.message === CustomError.TOKEN_EXPIRED) { + setErrorMessage(constants.LINK_EXPIRED); // share has been disabled // local cache should be cleared removePublicCollectionWithFiles( @@ -155,6 +158,11 @@ export default function PublicCollectionGallery() { if (!publicFiles && loading) { return ; } + + if (errorMessage && !loading) { + return {errorMessage}; + } + if (!publicFiles && !loading) { return {constants.NOT_FOUND}; } diff --git a/src/services/publicCollectionService.ts b/src/services/publicCollectionService.ts index 29426b8bc..84c95627f 100644 --- a/src/services/publicCollectionService.ts +++ b/src/services/publicCollectionService.ts @@ -321,6 +321,8 @@ export const removePublicCollectionWithFiles = async ( ) ); + await localForage.removeItem(getPublicCollectionSyncTimeUID(collectionUID)); + const publicCollectionFiles = (await localForage.getItem( PUBLIC_COLLECTION_FILES_TABLE diff --git a/src/utils/strings/englishConstants.tsx b/src/utils/strings/englishConstants.tsx index b77d46490..25123ae39 100644 --- a/src/utils/strings/englishConstants.tsx +++ b/src/utils/strings/englishConstants.tsx @@ -627,6 +627,7 @@ const englishConstants = { ALBUM_URL: 'album url', PUBLIC_SHARING: 'link sharing', NOT_FOUND: '404 - not found', + LINK_EXPIRED: 'the link has expired!', DISABLE_PUBLIC_SHARING: "'disable public sharing", DISABLE_PUBLIC_SHARING_MESSAGE: 'are you sure you want to disable public sharing?',