Files
jrshikoku/components/発車時刻表/LED_inside_Component/TrainPositionDataDelete.tsx

51 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React, { FC } from "react";
import { Text } from "react-native";
import { Dialog, Button } from "react-native-elements";
type Props = {
dialog: boolean;
setDialog: (dialog: boolean) => void;
PosNum: number;
Line: string;
Pos: string;
StationNum: string;
};
export const StationPosDeleteDialog: FC<Props> = ({
dialog,
setDialog,
PosNum,
Line,
Pos,
StationNum
}) => {
const sendPlatformData = () => {
fetch(`https://n8n.haruk.in/webhook/JR-shikoku-PosID-v3`, {
method: "DELETE",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
PosId: PosNum,
lineName: Line,
StationName: Pos, //自動:駅名、漢字
}),
})
.then(() => {
alert("位置情報データ削除要求を送信しました。");
setDialog(false);
})
.catch(() => {
alert("位置情報データ削除要求の送信に失敗しました。");
});
};
return (
<Dialog isVisible={dialog} onBackdropPress={() => setDialog(false)}>
<Text></Text>
<Text>: {Line}</Text>
<Text>ID: {PosNum}</Text>
<Text>: {Pos}</Text>
<Text>: {StationNum}</Text>
<Button title="送信" onPress={sendPlatformData} />
</Dialog>
);
};