Skip to content

Commit

Permalink
fix(fetch): ui disabling error
Browse files Browse the repository at this point in the history
  • Loading branch information
itupix committed Feb 19, 2021
1 parent 86d7a95 commit 306178c
Showing 1 changed file with 31 additions and 15 deletions.
46 changes: 31 additions & 15 deletions src/services/Service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ export class Service {
userId?: string,
): Promise<ProfileType> {
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(
Expand All @@ -50,31 +54,43 @@ export class Service {
organizationName?: string,
): Promise<string> {
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(
provider: ProviderEnum,
params: ServiceParams,
): Promise<RepositoryType[]> {
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(
provider: ProviderEnum,
params: ServiceParams,
): Promise<PullRequestType[]> {
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);
}
}
}

0 comments on commit 306178c

Please sign in to comment.