Migrated createNewVisits action creator to RTK

This commit is contained in:
Alejandro Celaya 2022-11-05 13:05:44 +01:00
parent d588d8d9ef
commit 7c61033bdf

View file

@ -1,4 +1,4 @@
import { PayloadAction } from '@reduxjs/toolkit'; import { createAction, PayloadAction } from '@reduxjs/toolkit';
import { CreateVisit } from '../types'; import { CreateVisit } from '../types';
export const CREATE_VISITS = 'shlink/visitCreation/CREATE_VISITS'; export const CREATE_VISITS = 'shlink/visitCreation/CREATE_VISITS';
@ -7,7 +7,7 @@ export type CreateVisitsAction = PayloadAction<{
createdVisits: CreateVisit[]; createdVisits: CreateVisit[];
}>; }>;
export const createNewVisits = (createdVisits: CreateVisit[]): CreateVisitsAction => ({ export const createNewVisits = createAction(
type: CREATE_VISITS, CREATE_VISITS,
payload: { createdVisits }, (createdVisits: CreateVisit[]) => ({ payload: { createdVisits } }),
}); );