From 85e2ad329d89e57be4c094067de48525fe7673e3 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Thu, 18 Apr 2024 03:21:05 +0000 Subject: [PATCH] =?UTF-8?q?api=E5=87=A6=E7=90=86=E3=83=91=E3=82=B9?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E3=83=9F=E3=82=B9=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stateBox/useAllTrainDiagram.js | 3 +++ stateBox/useCurrentTrain.js | 1 + 2 files changed, 4 insertions(+) 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 })) )