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';
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 } }),
);