クエリの追加
This commit is contained in:
parent
7c6ef56ecb
commit
199d41fd83
@ -101,20 +101,16 @@ export const EachData: FC<Props> = (props) => {
|
||||
else return Pos.Pos == "" ? "" : `現在地:${Pos.Pos}`;
|
||||
};
|
||||
|
||||
const [platformNumber, setPlatformNumber] = useState<number>();
|
||||
useEffect(()=>{
|
||||
fetch("https://n8n.haruk.in/webhook/JR-shikoku-PosID?num="+currentTrainData?.PosNum)
|
||||
.then(res=>res.json())
|
||||
.then(data=>{
|
||||
if(data?.type == "Station"){
|
||||
setPlatformNumber(data?.platform);
|
||||
}
|
||||
else{
|
||||
setPlatformNumber(undefined);
|
||||
}
|
||||
})
|
||||
},[currentTrainData,currentTrain])
|
||||
|
||||
const [platformNumber, setPlatformNumber] = useState<number>();
|
||||
useEffect(() => {
|
||||
fetch(
|
||||
`https://n8n.haruk.in/webhook/JR-shikoku-PosID?PosNum=${currentTrainData?.PosNum}&Line=${currentTrainData?.Line}`
|
||||
)
|
||||
.then((res) => res.json())
|
||||
.then((data) =>
|
||||
setPlatformNumber(data?.type == "Station" ? data?.platform : undefined)
|
||||
);
|
||||
}, [currentTrainData, currentTrain]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -147,7 +143,7 @@ useEffect(()=>{
|
||||
trainIDSwitch
|
||||
? currentTrainData?.PosNum
|
||||
: trainPositionText(currentTrainData)
|
||||
} ${platformNumber? platformNumber+"番線":""}`}
|
||||
} ${platformNumber ? platformNumber + "番線" : ""}`}
|
||||
onLongClick={() => {
|
||||
Linking.openURL(
|
||||
"https://nexcloud.haruk.in/apps/forms/s/TEkBQW5WLcYjLyAzGxncQLtw"
|
||||
|
@ -1,4 +1,6 @@
|
||||
export const checkDuplicateTrainData = (currentTrainArray) => {
|
||||
import { trainDataType } from "./trainPositionTextArray";
|
||||
|
||||
export const checkDuplicateTrainData = (currentTrainArray: trainDataType[]) => {
|
||||
const notNyujoData = currentTrainArray.filter((d) => d.delay !== "入線");
|
||||
if (currentTrainArray.length == 1) return currentTrainArray[0];
|
||||
if (notNyujoData.length == 0) return currentTrainArray[0];
|
@ -1,5 +1,7 @@
|
||||
import { trainDataType } from "./trainPositionTextArray";
|
||||
|
||||
type getTrainDelayStatus = (
|
||||
current: { delay: number | "入線" | string; Pos: string },
|
||||
current: trainDataType,
|
||||
Station_JP: string
|
||||
) => string | number;
|
||||
export const getTrainDelayStatus: getTrainDelayStatus = (
|
||||
|
@ -14,6 +14,12 @@ type returnCurrentType = {
|
||||
export type trainDataType = {
|
||||
Pos?: string;
|
||||
Direction?: number;
|
||||
Index?: number;
|
||||
Line?: string;
|
||||
PosNum?: number;
|
||||
Type?: string;
|
||||
delay?: string | number;
|
||||
num?: string;
|
||||
};
|
||||
type trainData = (
|
||||
trainData: trainDataType
|
||||
|
Loading…
Reference in New Issue
Block a user