updating fetch request

This commit is contained in:
Arslan, Erdem
2024-01-21 21:24:17 +01:00
parent 522d7eb69a
commit ec67dd1bac

View File

@@ -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>;