make all test work again locally

This commit is contained in:
2020-04-18 18:13:52 +02:00
parent d9c61d6afd
commit 7d4e24cb5c
3 changed files with 3 additions and 2 deletions

View File

@@ -34,6 +34,8 @@ app.use(express.static(path.join(__dirname, 'frontend')));
app.use(express.static(`${__dirname}/./frontend`)); app.use(express.static(`${__dirname}/./frontend`));
app.all("/*", function (req, res, next) { app.all("/*", function (req, res, next) {
if (/^\/simcompanies\/API\/.*/.test(req.url))
req.url = req.url.substring(13);
if (!/^\/API\/.*/.test(req.url)) { if (!/^\/API\/.*/.test(req.url)) {
return res.sendFile(path.join(__dirname, 'frontend', 'index.html')); return res.sendFile(path.join(__dirname, 'frontend', 'index.html'));
} else return next(); } else return next();

View File

@@ -11,7 +11,6 @@ export default function ResourceChart(props) {
const [data, setData] = React.useState(null); const [data, setData] = React.useState(null);
let { id } = useParams(); let { id } = useParams();
const loadData = async () => { const loadData = async () => {
console.log(id)
let nextData = await fetch(`/simcompanies/API/day?date=${props["day"]}&kind=${id}`); let nextData = await fetch(`/simcompanies/API/day?date=${props["day"]}&kind=${id}`);
nextData = await nextData.json(); nextData = await nextData.json();
for (let i = 0; i < nextData.length; i++) { for (let i = 0; i < nextData.length; i++) {

View File

@@ -39,7 +39,7 @@ export default function SelectResource() {
const [resources, setResources] = React.useState(null); const [resources, setResources] = React.useState(null);
const loadResources = async () => { const loadResources = async () => {
var resourceJSON = await fetch("API/resourcelist"); var resourceJSON = await fetch("/simcompanies/API/resourcelist");
resourceJSON = await resourceJSON.json(); resourceJSON = await resourceJSON.json();
let rArr = []; let rArr = [];
for (let i = 0; i < resourceJSON.length; i++) { for (let i = 0; i < resourceJSON.length; i++) {