From ae881e6a4f56030f2d016ce4505a48f6beb246ac Mon Sep 17 00:00:00 2001 From: abhinav-grd Date: Tue, 21 Sep 2021 11:56:26 +0530 Subject: [PATCH] fix isSharedCollection --- src/utils/collection/index.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/utils/collection/index.ts b/src/utils/collection/index.ts index 5a0ed6d67..1c13c40c1 100644 --- a/src/utils/collection/index.ts +++ b/src/utils/collection/index.ts @@ -66,8 +66,12 @@ export function isSharedCollection( collectionID: number ) { const user: User = getData(LS_KEYS.USER); - return ( - collections.find((collection) => collection.id === collectionID)?.owner - .id !== user.id + + const collection = collections.find( + (collection) => collection.id === collectionID ); + if (!collection) { + return false; + } + return collection?.owner.id !== user.id; }