Skip to content

Commit

Permalink
fix(request): fix request overlap
Browse files Browse the repository at this point in the history
  • Loading branch information
Ibrahimsyah committed Mar 30, 2024
1 parent 111defe commit e8b0eac
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pages/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const Home = () => {
const [mutationLoading, setMutationLoading] = useState<{ [key: string]: boolean }>({})
const [reportStartTime, setReportStartTime] = useState<Dayjs>(createDateHourDayJSNow().add(-1, "hour"))
const sensorReportCardRef = useRef<HTMLElement>()
const {setTab} = useTabStore()
const { setTab } = useTabStore()

const actions = useQuery<Action[]>({
queryKey: [actionAPI.QUERY_KEY_GET_ACTIONS],
Expand Down Expand Up @@ -84,11 +84,14 @@ const Home = () => {
})


const mutateState = (actuator_id: number, state: boolean) => {
const mutateState = (actuator_id: number, value: boolean) => {
if (mutationLoading[actuator_id]) {
return
}
const request: DispatchActionRequest = {
actuator_id,
device_id: 1,
value: state,
value: value,
}
actionMutation.mutate(request)
}
Expand Down

0 comments on commit e8b0eac

Please sign in to comment.