diff --git a/src/visits/reducers/visitCreation.ts b/src/visits/reducers/visitCreation.ts index 9400c02f..a14a339a 100644 --- a/src/visits/reducers/visitCreation.ts +++ b/src/visits/reducers/visitCreation.ts @@ -1,4 +1,4 @@ -import { PayloadAction } from '@reduxjs/toolkit'; +import { createAction, PayloadAction } from '@reduxjs/toolkit'; import { CreateVisit } from '../types'; export const CREATE_VISITS = 'shlink/visitCreation/CREATE_VISITS'; @@ -7,7 +7,7 @@ export type CreateVisitsAction = PayloadAction<{ createdVisits: CreateVisit[]; }>; -export const createNewVisits = (createdVisits: CreateVisit[]): CreateVisitsAction => ({ - type: CREATE_VISITS, - payload: { createdVisits }, -}); +export const createNewVisits = createAction( + CREATE_VISITS, + (createdVisits: CreateVisit[]) => ({ payload: { createdVisits } }), +);