remove deleted collection from local

This commit is contained in:
abhinav-grd 2021-09-10 09:11:38 +05:30
parent a1a73b0cbd
commit 37bb67ea21
2 changed files with 6 additions and 0 deletions

View file

@ -23,6 +23,7 @@ import {
getFavItemIds,
getLocalCollections,
getNonEmptyCollections,
setLocalCollection,
} from 'services/collectionService';
import constants from 'utils/strings/constants';
import billingService from 'services/billingService';
@ -258,6 +259,7 @@ export default function Gallery() {
collectionFilesCount.set(id, files.length);
}
setCollections(nonEmptyCollections);
setLocalCollection(nonEmptyCollections);
setCollectionsAndTheirLatestFile(collectionsAndTheirLatestFile);
setCollectionFilesCount(collectionFilesCount);
const favItemIds = await getFavItemIds(files);

View file

@ -184,6 +184,10 @@ export const syncCollections = async () => {
return collections;
};
export const setLocalCollection = async (collections: Collection[]) => {
await localForage.setItem(COLLECTIONS, collections);
};
export const getCollectionsAndTheirLatestFile = (
collections: Collection[],
files: File[]