Created
February 22, 2021 20:04
-
-
Save AllGistsEqual/7568bd8b615a2cea6c54232c29c38504 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File: src/redux/ducks/api.ts | |
export const apiRequest = createAction( | |
"[API] Request", | |
(api: ApiRequestPayload<any>) => ({ // eslint-disable-line @typescript-eslint/no-explicit-any | |
payload: { ...api }, | |
}) | |
) | |
export const apiSuccess = createAction( | |
"[API] Success", | |
(onSuccess: SuccessAction<unknown>, data: unknown) => ({ | |
payload: { onSuccess, data }, | |
}) | |
) | |
export const apiError = createAction( | |
"[API] Error", | |
(onError: ErrorAction, message: string) => ({ | |
payload: { onError, message }, | |
}) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment