From c25509c62f4362d8b1b45cd16d7ca55b4ea42fef Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 27 Mar 2024 08:19:50 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E5=9C=A8=E7=B7=9A=E5=8F=96=E5=BE=97?= =?UTF-8?q?=E3=82=92n8n=E3=81=AB=E7=A7=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stateBox/useCurrentTrain.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/stateBox/useCurrentTrain.js b/stateBox/useCurrentTrain.js index 9e181d8..1c79710 100644 --- a/stateBox/useCurrentTrain.js +++ b/stateBox/useCurrentTrain.js @@ -26,11 +26,8 @@ export const useCurrentTrain = () => { export const CurrentTrainProvider = ({ children }) => { const [currentTrain, setCurrentTrain] = useState([]); //現在在線中の全列車 { num: 列車番号, delay: 遅延時分(状態), Pos: 位置情報 } const [currentTrainLoading, setCurrentTrainLoading] = useState("loading"); // success, error, loading - const getCurrentTrain = () => - fetch( - "https://script.google.com/macros/s/AKfycby9Y2-Bm75J_WkbZimi7iS8v5r9wMa9wtzpdwES9sOGF4i6HIYEJOM60W6gM1gXzt1o/exec", - HeaderConfig - ) + const getCurrentTrain = () => { + fetch("https://n8n.haruk.in/webhook/c501550c-7d1b-4e50-927b-4429fe18931a") .then((response) => response.json()) .then((d) => d.map((x) => ({ num: x.TrainNum, delay: x.delay, Pos: x.Pos })) @@ -40,9 +37,24 @@ export const CurrentTrainProvider = ({ children }) => { setCurrentTrainLoading("success"); }) .catch(() => { - console.log("えらー"); - setCurrentTrainLoading("error"); + fetch( + "https://script.google.com/macros/s/AKfycby9Y2-Bm75J_WkbZimi7iS8v5r9wMa9wtzpdwES9sOGF4i6HIYEJOM60W6gM1gXzt1o/exec", + HeaderConfig + ) + .then((response) => response.json()) + .then((d) => + d.map((x) => ({ num: x.TrainNum, delay: x.delay, Pos: x.Pos })) + ) + .then((d) => { + setCurrentTrain(d); + setCurrentTrainLoading("success"); + }) + .catch(() => { + console.log("えらー"); + setCurrentTrainLoading("error"); + }); }); + }; useEffect(getCurrentTrain, []); //初回だけ現在の全在線列車取得 From a87b29e961756d48345093ba5290ea69cec64547 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 27 Mar 2024 14:35:49 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E5=88=97=E8=BB=8A=E3=83=80=E3=82=A4?= =?UTF-8?q?=E3=83=A4=E3=82=82=E7=A7=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stateBox/useAllTrainDiagram.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/stateBox/useAllTrainDiagram.js b/stateBox/useAllTrainDiagram.js index f4f5158..dde9af8 100644 --- a/stateBox/useAllTrainDiagram.js +++ b/stateBox/useAllTrainDiagram.js @@ -12,11 +12,10 @@ export const useAllTrainDiagram = () => { export const AllTrainDiagramProvider = ({ children }) => { const [allTrainDiagram, setAllTrainDiagram] = useState(); - const customData = { - }; + const customData = {}; useEffect(() => { fetch( - "https://script.google.com/macros/s/AKfycbx_s7RB-xTy-iAslFJg7LfplLV09-hjDXEjdi9kCP_JT45wq17Af_IPOKIOqIfaNDg/exec" + "http://n8n.haruk.in/webhook/CrowdTh%E2%82%AC71m3Ra7!ngLead%E2%82%ACr$" ) .then((res) => res.json()) .then((res) => { @@ -30,6 +29,24 @@ export const AllTrainDiagramProvider = ({ children }) => { .then((res) => { Object.assign(res, customData); setAllTrainDiagram(res); + }) + .catch((d) => { + fetch( + "https://script.google.com/macros/s/AKfycbx_s7RB-xTy-iAslFJg7LfplLV09-hjDXEjdi9kCP_JT45wq17Af_IPOKIOqIfaNDg/exec" + ) + .then((res) => res.json()) + .then((res) => { + const data = {}; + res.forEach((d) => { + const keys = Object.keys(d); + data[keys] = d[keys]; + }); + return data; + }) + .then((res) => { + Object.assign(res, customData); + setAllTrainDiagram(res); + }); }); }, []); From dd7da102c43348a5420a4b616509d37c8d03a65f Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 27 Mar 2024 15:52:15 +0000 Subject: [PATCH 3/3] 5.0.3.2 --- components/settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/settings.js b/components/settings.js index 1224d96..b82796b 100644 --- a/components/settings.js +++ b/components/settings.js @@ -171,7 +171,7 @@ export default function Setting() { textAlignVertical: "center", }} > - 内部バージョン: 5.0.3.1 + 内部バージョン: 5.0.3.2