@bhupinderanand/react-redux-saga-boilerplate
Version:
Boilerplate with React and Redux with Redux Saga
22 lines (17 loc) • 689 B
text/typescript
import { createAction } from '@reduxjs/toolkit';
import { actionPayload } from 'modules/helpers';
import { ActionTypes } from 'literals';
export interface GetReposSuccessMeta {
cached: boolean;
query: string;
updatedAt: number;
}
export const getRepos = createAction<string>(ActionTypes.GITHUB_GET_REPOS_REQUEST);
export const getReposSuccess = createAction(
ActionTypes.GITHUB_GET_REPOS_SUCCESS,
(payload: Record<string, any>[], meta: GetReposSuccessMeta) => actionPayload(payload, meta),
);
export const getReposFailure = createAction(
ActionTypes.GITHUB_GET_REPOS_FAILURE,
(payload: string, query: string) => actionPayload(payload, { query }),
);