generated from Luis/nextjs-python-web-template
frontend #35
@@ -15,24 +15,24 @@ export default function AccessPoint() {
|
|||||||
const [repositoryData, setRepositoryData] = useState([]);
|
const [repositoryData, setRepositoryData] = useState([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetch('http://localhost:2979/api/v1/get_repositories', {
|
fetch("http://localhost:2979/api/v1/get_repositories", {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
// credentials: 'include',
|
// credentials: 'include',
|
||||||
})
|
})
|
||||||
.then(resp => resp.json().then(jsonData => {
|
.then((resp) =>
|
||||||
|
resp.json().then((jsonData) => {
|
||||||
console.log(jsonData);
|
console.log(jsonData);
|
||||||
if (jsonData.length > 0) {
|
if (jsonData.length > 0) {
|
||||||
setRepositoryData(jsonData);
|
setRepositoryData(jsonData);
|
||||||
} else {
|
} else {
|
||||||
setRepositoryData(APServiceRepositoryDummyData);
|
setRepositoryData(APServiceRepositoryDummyData);
|
||||||
}
|
}
|
||||||
}
|
}),
|
||||||
))
|
)
|
||||||
.then()
|
.then()
|
||||||
.catch()
|
.catch();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="m-10">
|
<div className="m-10">
|
||||||
<SummaryDetails
|
<SummaryDetails
|
||||||
|
|||||||
@@ -16,37 +16,39 @@ export default function Client1() {
|
|||||||
const [producerData, setProducerData] = useState([]);
|
const [producerData, setProducerData] = useState([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetch('http://localhost:2979/api/v1/get_consumers', {
|
fetch("http://localhost:2979/api/v1/get_consumers", {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
// credentials: 'include',
|
// credentials: 'include',
|
||||||
})
|
})
|
||||||
.then(resp => resp.json().then(jsonData => {
|
.then((resp) =>
|
||||||
|
resp.json().then((jsonData) => {
|
||||||
console.log(jsonData);
|
console.log(jsonData);
|
||||||
if (jsonData.length > 0) {
|
if (jsonData.length > 0) {
|
||||||
setConsumerData(jsonData);
|
setConsumerData(jsonData);
|
||||||
} else {
|
} else {
|
||||||
setConsumerData(Client1ConsumerData);
|
setConsumerData(Client1ConsumerData);
|
||||||
}
|
}
|
||||||
}
|
}),
|
||||||
))
|
)
|
||||||
.then()
|
.then()
|
||||||
.catch()
|
.catch();
|
||||||
|
|
||||||
fetch('http://localhost:2979/api/v1/get_producers', {
|
fetch("http://localhost:2979/api/v1/get_producers", {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
// credentials: 'include',
|
// credentials: 'include',
|
||||||
})
|
})
|
||||||
.then(resp => resp.json().then(jsonData => {
|
.then((resp) =>
|
||||||
|
resp.json().then((jsonData) => {
|
||||||
console.log(jsonData);
|
console.log(jsonData);
|
||||||
if (jsonData.length > 0) {
|
if (jsonData.length > 0) {
|
||||||
setProducerData(jsonData);
|
setProducerData(jsonData);
|
||||||
} else {
|
} else {
|
||||||
setProducerData(Client1ProducerData);
|
setProducerData(Client1ProducerData);
|
||||||
}
|
}
|
||||||
}
|
}),
|
||||||
))
|
)
|
||||||
.then()
|
.then()
|
||||||
.catch()
|
.catch();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user