diff --git a/components/Settings/SettingTopPage.js b/components/Settings/SettingTopPage.js
index 3873621..490caf0 100644
--- a/components/Settings/SettingTopPage.js
+++ b/components/Settings/SettingTopPage.js
@@ -85,7 +85,7 @@ export const SettingTopPage = ({
/>
- 内部バージョン: 5.0.3.1
+ 内部バージョン: 5.0.3.2
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);
+ });
});
}, []);
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, []); //初回だけ現在の全在線列車取得