frontend #35

Merged
merge-bot merged 18 commits from frontend into main 2023-12-09 18:43:16 +00:00
2 changed files with 89 additions and 87 deletions
Showing only changes of commit d95c6ba981 - Show all commits

View File

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

View File

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