From 306178ccbc941ffc7200db3ad20623f6c02badef Mon Sep 17 00:00:00 2001 From: itupix Date: Fri, 19 Feb 2021 15:10:17 +0100 Subject: [PATCH] fix(fetch): ui disabling error --- src/services/Service.ts | 46 +++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/src/services/Service.ts b/src/services/Service.ts index ba2548b..4ef557c 100644 --- a/src/services/Service.ts +++ b/src/services/Service.ts @@ -39,9 +39,13 @@ export class Service { userId?: string, ): Promise { isFetchingData.set(true); - const result = await Service.INSTANCES[provider].getProfile(userId); - isFetchingData.set(false); - return result; + try { + const result = await Service.INSTANCES[provider].getProfile(userId); + isFetchingData.set(false); + return result; + } catch { + isFetchingData.set(false); + } } public static async getAvatar( @@ -50,12 +54,16 @@ export class Service { organizationName?: string, ): Promise { isFetchingData.set(true); - const result = await Service.INSTANCES[provider].getAvatar( - params, - organizationName, - ); - isFetchingData.set(false); - return result; + try { + const result = await Service.INSTANCES[provider].getAvatar( + params, + organizationName, + ); + isFetchingData.set(false); + return result; + } catch { + isFetchingData.set(false); + } } public static async getRepositories( @@ -63,9 +71,13 @@ export class Service { params: ServiceParams, ): Promise { isFetchingData.set(true); - const result = await Service.INSTANCES[provider].getRepositories(params); - isFetchingData.set(false); - return result; + try { + const result = await Service.INSTANCES[provider].getRepositories(params); + isFetchingData.set(false); + return result; + } catch { + isFetchingData.set(false); + } } public static async getPullRequests( @@ -73,8 +85,12 @@ export class Service { params: ServiceParams, ): Promise { isFetchingData.set(true); - const result = await Service.INSTANCES[provider].getPullRequests(params); - isFetchingData.set(false); - return result; + try { + const result = await Service.INSTANCES[provider].getPullRequests(params); + isFetchingData.set(false); + return result; + } catch { + isFetchingData.set(false); + } } }