generated from Luis/nextjs-python-web-template
updating fetch request
This commit is contained in:
@@ -14,11 +14,13 @@ export const ClientTableConfig = [
|
|||||||
label: "End Point",
|
label: "End Point",
|
||||||
render: (value: any) => {
|
render: (value: any) => {
|
||||||
const onConsume = () => {
|
const onConsume = () => {
|
||||||
fetch(value).then((response) => {
|
fetch(value)
|
||||||
console.log(response)
|
.then((response) => {
|
||||||
}).catch(error => {
|
console.log(response);
|
||||||
console.log("Fetch error: ", error)
|
|
||||||
})
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log("Fetch error: ", error);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<Button onClick={onConsume} variant="outlined">
|
<Button onClick={onConsume} variant="outlined">
|
||||||
@@ -89,11 +91,13 @@ export const ServiceTableConfig = [
|
|||||||
|
|
||||||
const onButtonClick = (endpoint: string) => {
|
const onButtonClick = (endpoint: string) => {
|
||||||
console.log("which endpoint comes here?", endpoint);
|
console.log("which endpoint comes here?", endpoint);
|
||||||
fetch(endpoint).then((response) => {
|
fetch(endpoint)
|
||||||
|
.then((response) => {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
}).catch(error => {
|
|
||||||
console.log("Fetch error: ", error)
|
|
||||||
})
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log("Fetch error: ", error);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!data) return <div>N/A</div>;
|
if (!data) return <div>N/A</div>;
|
||||||
|
|||||||
Reference in New Issue
Block a user