From e950f88cf6b0fb83cdbf7e8797870409e17d780d Mon Sep 17 00:00:00 2001 From: Lyka Labrada Date: Tue, 17 Oct 2023 13:53:39 +0800 Subject: [PATCH] fix provider storage not setting properly --- mobile-app/app/api/wallet/service_provider.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mobile-app/app/api/wallet/service_provider.ts b/mobile-app/app/api/wallet/service_provider.ts index 202ce250be..f17c191cf9 100644 --- a/mobile-app/app/api/wallet/service_provider.ts +++ b/mobile-app/app/api/wallet/service_provider.ts @@ -7,20 +7,19 @@ async function set( url: NonNullable, type: CustomServiceProviderType = CustomServiceProviderType.DVM, ): Promise { - const STORAGE_KEY = - type === CustomServiceProviderType.DVM ? KEY : `${KEY}.${type}`; - await SecuredStoreAPI.setItem(STORAGE_KEY, url); + await SecuredStoreAPI.setItem(`${KEY}.${type}`, url); } async function get( type: CustomServiceProviderType = CustomServiceProviderType.DVM, ): Promise { - const val = await SecuredStoreAPI.getItem(`${KEY}.${type}`); + const PROVIDER_KEY = `${KEY}.${type}`; + const val = await SecuredStoreAPI.getItem(PROVIDER_KEY); if (type === CustomServiceProviderType.DVM && val === null) { const existingDvm = await SecuredStoreAPI.getItem(KEY); if (existingDvm !== null) { - await set(existingDvm, CustomServiceProviderType.DVM); + await SecuredStoreAPI.setItem(PROVIDER_KEY, existingDvm); await SecuredStoreAPI.removeItem(KEY); return existingDvm; }