1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00
vault-frontend/src/redux/lab/handlers.ts
2021-03-12 13:56:23 +07:00

20 lines
489 B
TypeScript

import { LAB_ACTIONS } from '~/redux/lab/constants';
import { labSetList } from '~/redux/lab/actions';
import { ILabState } from '~/redux/lab/types';
type LabHandler<T extends (...args: any) => any> = (
state: Readonly<ILabState>,
payload: ReturnType<T>
) => Readonly<ILabState>;
const setList: LabHandler<typeof labSetList> = (state, { list }) => ({
...state,
list: {
...state.list,
...list,
},
});
export const LAB_HANDLERS = {
[LAB_ACTIONS.SET_LIST]: setList,
};