diff --git a/stateBox/useAllTrainDiagram.js b/stateBox/useAllTrainDiagram.js index dde9af8..912aa37 100644 --- a/stateBox/useAllTrainDiagram.js +++ b/stateBox/useAllTrainDiagram.js @@ -18,7 +18,9 @@ export const AllTrainDiagramProvider = ({ children }) => { "http://n8n.haruk.in/webhook/CrowdTh%E2%82%AC71m3Ra7!ngLead%E2%82%ACr$" ) .then((res) => res.json()) + .then((res) => res.data) .then((res) => { + console.log(res); const data = {}; res.forEach((d) => { const keys = Object.keys(d); @@ -31,6 +33,7 @@ export const AllTrainDiagramProvider = ({ children }) => { setAllTrainDiagram(res); }) .catch((d) => { + alert("error"); fetch( "https://script.google.com/macros/s/AKfycbx_s7RB-xTy-iAslFJg7LfplLV09-hjDXEjdi9kCP_JT45wq17Af_IPOKIOqIfaNDg/exec" ) diff --git a/stateBox/useCurrentTrain.js b/stateBox/useCurrentTrain.js index 1c79710..adeb371 100644 --- a/stateBox/useCurrentTrain.js +++ b/stateBox/useCurrentTrain.js @@ -29,6 +29,7 @@ export const CurrentTrainProvider = ({ children }) => { const getCurrentTrain = () => { fetch("https://n8n.haruk.in/webhook/c501550c-7d1b-4e50-927b-4429fe18931a") .then((response) => response.json()) + .then((d) => d.data) .then((d) => d.map((x) => ({ num: x.TrainNum, delay: x.delay, Pos: x.Pos })) )