chore(deps): bump react-use from 14.2.0 to 15.3.3

This is a copy of #1731 with fixes
This commit is contained in:
dependabot-preview[bot]
2020-08-03 08:25:35 +00:00
committed by Fredrik Adelöw
parent d15cc81c75
commit 14cfeb390e
29 changed files with 77 additions and 59 deletions
@@ -17,8 +17,14 @@ import { useAsync } from 'react-use';
import { Jobs } from '../../api/types';
export const useWorkflowRunJobs = (jobsUrl?: string) => {
const jobs = useAsync<Jobs>(async () => {
if (jobsUrl === undefined) return [];
const jobs = useAsync(async (): Promise<Jobs> => {
if (jobsUrl === undefined) {
return {
total_count: 0,
jobs: [],
};
}
const data = await fetch(jobsUrl).then(d => d.json());
return data;
}, [jobsUrl]);
@@ -21,7 +21,7 @@ import { useApi } from '@backstage/core';
export const useProjectName = (name: EntityCompoundName) => {
const catalogApi = useApi(catalogApiRef);
const { value, loading, error } = useAsync<string>(async () => {
const { value, loading, error } = useAsync(async () => {
const entity = await catalogApi.getEntityByName(name);
return entity?.metadata.annotations?.['github.com/project-slug'] ?? '';
});