Handle the case of deleted collections

This commit is contained in:
Vishnu Mohandas 2020-11-20 16:52:04 +05:30
parent 2eebd82776
commit 8f1d37b071

View file

@ -36,6 +36,7 @@ export interface collection {
creationTime: number;
encryptedKey: string;
keyDecryptionNonce: string;
isDeleted: boolean;
}
export interface file {
@ -96,6 +97,10 @@ export const getFiles = async (sinceTime: string, token: string, limit: string,
var files: Array<file> = await localForage.getItem<file[]>('files') || [];
for (const index in collections) {
const collection = collections[index];
if (collection.isDeleted) {
// TODO: Remove files in this collection from localForage
continue;
}
let time = await localForage.getItem<string>(`${collection.id}-time`) || sinceTime;
let resp;
do {