generated from Luis/nextjs-python-web-template
Added a lot of fixes #73
@@ -1,4 +1,5 @@
|
|||||||
import { Button, Tooltip } from "@mui/material";
|
import {Button, CircularProgress, Tooltip} from "@mui/material";
|
||||||
|
import {useState} from "react";
|
||||||
|
|
||||||
export const ClientTableConfig = [
|
export const ClientTableConfig = [
|
||||||
{
|
{
|
||||||
@@ -13,18 +14,22 @@ export const ClientTableConfig = [
|
|||||||
key: "endpoint_url",
|
key: "endpoint_url",
|
||||||
label: "End Point",
|
label: "End Point",
|
||||||
render: (value: any) => {
|
render: (value: any) => {
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const onConsume = () => {
|
const onConsume = () => {
|
||||||
|
setIsLoading(true);
|
||||||
fetch(value)
|
fetch(value)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
setIsLoading(false)
|
||||||
console.log(response);
|
console.log(response);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
setIsLoading(false)
|
||||||
console.log("Fetch error: ", error);
|
console.log("Fetch error: ", error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<Button onClick={onConsume} variant="outlined">
|
<Button onClick={onConsume} variant="outlined">
|
||||||
Consume
|
{isLoading ? <CircularProgress size={20} /> : 'Consume'}
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user