esLint
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useAppDispatch } from "../../../../../../redux/store";
|
||||
import { RootState } from "../../../../../../redux/store";
|
||||
import { fetchTDMDataBySlotThunk } from "../../../../../../redux/thunks/getTDMListBySlotThunk";
|
||||
import { getTDRChartDataByIdThunk } from "../../../../../../redux/thunks/getTDRChartDataByIdThunk";
|
||||
import { getReferenceCurveBySlotThunk } from "../../../../../../redux/thunks/getReferenceCurveBySlotThunk"; // ⬅ import ergänzen
|
||||
import { useAppDispatch } from "@/redux/store";
|
||||
import { RootState } from "@/redux/store";
|
||||
import { fetchTDMDataBySlotThunk } from "@/redux/thunks/getTDMListBySlotThunk";
|
||||
import { getTDRChartDataByIdThunk } from "@/redux/thunks/getTDRChartDataByIdThunk";
|
||||
import { getReferenceCurveBySlotThunk } from "@/redux/thunks/getReferenceCurveBySlotThunk"; // ⬅ import ergänzen
|
||||
|
||||
const TDRChartActionBar: React.FC = () => {
|
||||
const dispatch = useAppDispatch();
|
||||
@@ -91,10 +91,16 @@ const TDRChartActionBar: React.FC = () => {
|
||||
// 📥 Beim Slot-Wechsel TDM-Liste + letzte ID laden
|
||||
useEffect(() => {
|
||||
if (selectedSlot !== null) {
|
||||
dispatch(fetchTDMDataBySlotThunk(selectedSlot)).then((action: any) => {
|
||||
const slotData = action.payload?.data;
|
||||
if (slotData?.length > 0) {
|
||||
const lastId = slotData[0].id;
|
||||
dispatch(fetchTDMDataBySlotThunk(selectedSlot)).then((action) => {
|
||||
// action can be a PayloadAction with payload or a rejected action
|
||||
const payload = (
|
||||
action as {
|
||||
payload?: { data?: { id: number; t: string; d: number }[] };
|
||||
}
|
||||
).payload;
|
||||
const slotData = payload?.data;
|
||||
if ((slotData ?? []).length > 0) {
|
||||
const lastId = (slotData ?? [])[0].id;
|
||||
setSelectedId(lastId);
|
||||
dispatch(getTDRChartDataByIdThunk(lastId));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user