generated from Luis/nextjs-python-web-template
frontend #35
@@ -9,30 +9,30 @@ import {
|
|||||||
APServiceRepositoryDummyData,
|
APServiceRepositoryDummyData,
|
||||||
APServiceRepositoryTableConfig,
|
APServiceRepositoryTableConfig,
|
||||||
} from "@/mock/access_point";
|
} from "@/mock/access_point";
|
||||||
import {useEffect, useState} from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
export default function AccessPoint() {
|
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
|
||||||
|
|||||||
@@ -9,44 +9,46 @@ import {
|
|||||||
Client1ProducerData,
|
Client1ProducerData,
|
||||||
} from "@/mock/client_1";
|
} from "@/mock/client_1";
|
||||||
import CustomTable from "@/components/table";
|
import CustomTable from "@/components/table";
|
||||||
import {useEffect, useState} from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
export default function Client1() {
|
export default function Client1() {
|
||||||
const [consumerData, setConsumerData] = useState([]);
|
const [consumerData, setConsumerData] = useState([]);
|
||||||
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