47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import React, { FC } from "react";
|
||
import { Text } from "react-native";
|
||
import { Dialog, Button } from "react-native-elements";
|
||
import { trainDataType } from "../../../lib/trainPositionTextArray";
|
||
type Props = {
|
||
dialog: boolean;
|
||
setDialog: (dialog: boolean) => void;
|
||
currentTrainData: trainDataType;
|
||
stationInput: string;
|
||
stationNumberInput: string;
|
||
};
|
||
export const TrainPositionDataDelete: FC<Props> = ({
|
||
dialog,
|
||
setDialog,
|
||
currentTrainData,
|
||
stationInput,
|
||
stationNumberInput,
|
||
}) => {
|
||
const sendPlatformData = () => {
|
||
fetch(`https://n8n.haruk.in/webhook/JR-shikoku-PosID`, {
|
||
method: "DELETE",
|
||
headers: { "Content-Type": "application/json" },
|
||
body: JSON.stringify({
|
||
PosId: currentTrainData?.PosNum,
|
||
lineName: currentTrainData?.Line,
|
||
}),
|
||
})
|
||
.then(() => {
|
||
alert("位置情報データ削除要求を送信しました。");
|
||
setDialog(false);
|
||
})
|
||
.catch(() => {
|
||
alert("位置情報データ削除要求の送信に失敗しました。");
|
||
});
|
||
};
|
||
return (
|
||
<Dialog isVisible={dialog} onBackdropPress={() => setDialog(false)}>
|
||
<Text>以下のデータを誤情報として削除要求を出しますか?</Text>
|
||
<Text>路線: {currentTrainData?.Line}</Text>
|
||
<Text>地点ID: {currentTrainData?.PosNum}</Text>
|
||
<Text>駅名: {stationInput}</Text>
|
||
<Text>駅ナンバー: {stationNumberInput}</Text>
|
||
<Button title="送信" onPress={sendPlatformData} />
|
||
</Dialog>
|
||
);
|
||
};
|