From 3e30ce2178d6cfab147d25e35468c11dd87e9856 Mon Sep 17 00:00:00 2001 From: Ivan Chub Date: Thu, 14 Dec 2023 20:49:23 -0800 Subject: [PATCH] fix bug --- apps/passport-client/src/dispatch.ts | 10 ++-------- apps/passport-client/src/localstorage.ts | 12 +++++------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/apps/passport-client/src/dispatch.ts b/apps/passport-client/src/dispatch.ts index e6e3332c98..5ac4c13788 100644 --- a/apps/passport-client/src/dispatch.ts +++ b/apps/passport-client/src/dispatch.ts @@ -175,12 +175,7 @@ export async function dispatch( case "reset-passport": return resetPassport(state, update); case "load-after-login": - return loadAfterLogin( - state, - action.encryptionKey, - action.storage, - update - ); + return loadAfterLogin(action.encryptionKey, action.storage, update); case "set-modal": return update({ modal: action.modal @@ -501,7 +496,6 @@ async function removePCD(state: AppState, update: ZuUpdate, pcdId: string) { } async function loadAfterLogin( - state: AppState, encryptionKey: string, storage: StorageWithRevision, update: ZuUpdate @@ -532,7 +526,7 @@ async function loadAfterLogin( !validateAndLogStateErrors( userResponse.value, identityPCD.claim.identity, - state.pcds + pcds ) ) { update({ userInvalid: true }); diff --git a/apps/passport-client/src/localstorage.ts b/apps/passport-client/src/localstorage.ts index 19a2bf1097..c666bfd82e 100644 --- a/apps/passport-client/src/localstorage.ts +++ b/apps/passport-client/src/localstorage.ts @@ -44,13 +44,11 @@ export async function loadPCDs(): Promise { serializedCollection ?? "{}" ); - // const validationErrors = validatePCDCollection(collection); - // if (validationErrors.errors.length > 0) { - // logAndUploadValidationErrors(validationErrors); - // throw new Error( - // "couldn't load PCDs\n:" + validationErrors.errors.join("\n") - // ); - // } + if (validateAndLogStateErrors(undefined, undefined, collection, true)) { + console.log( + "PCD Collection failed to validate when loading from localstorage" + ); + } return collection; }