コードの整理
This commit is contained in:
parent
1575b643f7
commit
2e95a35fce
@ -137,12 +137,7 @@ export const EachData: FC<Props> = (props) => {
|
|||||||
const [stationNumberInput, setStationNumberInput] = useState("");
|
const [stationNumberInput, setStationNumberInput] = useState("");
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Dialog
|
<Dialog isVisible={dialog} onBackdropPress={() => setDialog(false)}>
|
||||||
isVisible={dialog}
|
|
||||||
onBackdropPress={() => {
|
|
||||||
setDialog(false);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Text>路線: {currentTrainData?.Line}</Text>
|
<Text>路線: {currentTrainData?.Line}</Text>
|
||||||
<Text>地点ID: {currentTrainData?.PosNum}</Text>
|
<Text>地点ID: {currentTrainData?.PosNum}</Text>
|
||||||
<Text>駅名: {stationInput}</Text>
|
<Text>駅名: {stationInput}</Text>
|
||||||
@ -162,25 +157,27 @@ export const EachData: FC<Props> = (props) => {
|
|||||||
<Button
|
<Button
|
||||||
title="送信"
|
title="送信"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
fetch(
|
fetch(`https://n8n.haruk.in/webhook/JR-shikoku-PosID`, {
|
||||||
`https://n8n.haruk.in/webhook/JR-shikoku-PosID`,{
|
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: { "Content-Type": "application/json" },
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
PosId: currentTrainData?.PosNum,
|
PosId: currentTrainData?.PosNum,
|
||||||
lineName: currentTrainData?.Line,
|
lineName: currentTrainData?.Line,
|
||||||
PlatformNum: parseInt(posInput),
|
PlatformNum: parseInt(posInput),
|
||||||
Description: descInput,
|
Description: descInput,
|
||||||
StationName: station.Station_JP,
|
StationName: station.Station_JP,
|
||||||
StationId: station.StationNumber
|
StationId: station.StationNumber,
|
||||||
}),
|
}),
|
||||||
}
|
})
|
||||||
);
|
.then(() => {
|
||||||
|
alert("位置情報データを送信しました。");
|
||||||
setDialog(false);
|
setDialog(false);
|
||||||
setPosInput("");
|
setPosInput("");
|
||||||
setDescInput("");
|
setDescInput("");
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
alert("位置情報データの送信に失敗しました。");
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
@ -220,7 +217,9 @@ export const EachData: FC<Props> = (props) => {
|
|||||||
const { isBetween, Pos } = trainPosition(currentTrainData);
|
const { isBetween, Pos } = trainPosition(currentTrainData);
|
||||||
if (isBetween === true) return;
|
if (isBetween === true) return;
|
||||||
setStationInput(Pos.Pos);
|
setStationInput(Pos.Pos);
|
||||||
setStationNumberInput(getStationID(currentTrainData?.Pos, stationList));
|
setStationNumberInput(
|
||||||
|
getStationID(currentTrainData?.Pos, stationList)
|
||||||
|
);
|
||||||
setDescInput(platformDescription || "");
|
setDescInput(platformDescription || "");
|
||||||
setPosInput(platformNumber?.toString() || "");
|
setPosInput(platformNumber?.toString() || "");
|
||||||
setDialog(true);
|
setDialog(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user