// /redux/thunks/getSystemVoltTempThunk.ts import { createAsyncThunk } from "@reduxjs/toolkit"; import { fetchSystemVoltTempService } from "../../services/fetchSystemVoltTempService"; import { setVoltages, addHistory } from "../slices/systemVoltTempSlice"; export const getSystemVoltTempThunk = createAsyncThunk( "systemVoltTemp/fetch", async (_, { dispatch }) => { const data = await fetchSystemVoltTempService(); if (data) { dispatch(setVoltages(data)); dispatch(addHistory({ time: Date.now(), ...data })); } } );