switches gcp-projects to use react-hookz
Signed-off-by: Brian Fletcher <brian@roadie.io>
This commit is contained in:
@@ -27,7 +27,7 @@ import {
|
||||
Typography,
|
||||
} from '@material-ui/core';
|
||||
import React from 'react';
|
||||
import useAsync from 'react-use/lib/useAsync';
|
||||
import { useAsync } from 'react-hookz';
|
||||
import { gcpApiRef } from '../../api';
|
||||
|
||||
import {
|
||||
@@ -61,9 +61,9 @@ const DetailsPage = () => {
|
||||
const classes = useStyles();
|
||||
|
||||
const {
|
||||
loading,
|
||||
status,
|
||||
result: details,
|
||||
error,
|
||||
value: details,
|
||||
} = useAsync(
|
||||
async () =>
|
||||
api.getProject(
|
||||
@@ -72,7 +72,7 @@ const DetailsPage = () => {
|
||||
[location.search],
|
||||
);
|
||||
|
||||
if (loading) {
|
||||
if (status === 'loading') {
|
||||
return <LinearProgress />;
|
||||
} else if (error) {
|
||||
return (
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
import { Button, LinearProgress, Tooltip, Typography } from '@material-ui/core';
|
||||
import React from 'react';
|
||||
|
||||
import useAsync from 'react-use/lib/useAsync';
|
||||
import { useAsync } from 'reach-hookz';
|
||||
import { gcpApiRef, Project } from '../../api';
|
||||
|
||||
import {
|
||||
@@ -58,9 +58,9 @@ const labels = (
|
||||
const PageContents = () => {
|
||||
const api = useApi(gcpApiRef);
|
||||
|
||||
const { loading, error, value } = useAsync(() => api.listProjects());
|
||||
const { status, result, error } = useAsync(() => api.listProjects());
|
||||
|
||||
if (loading) {
|
||||
if (status === 'loading') {
|
||||
return <LinearProgress />;
|
||||
} else if (error) {
|
||||
return (
|
||||
@@ -108,7 +108,7 @@ const PageContents = () => {
|
||||
},
|
||||
]}
|
||||
data={
|
||||
value?.map((project: Project) => ({
|
||||
result?.map((project: Project) => ({
|
||||
id: project.projectId,
|
||||
name: project.name,
|
||||
projectNumber: project?.projectNumber || 'Error',
|
||||
|
||||
Reference in New Issue
Block a user