Skip to content

Instantly share code, notes, and snippets.

@techomoro
Created October 6, 2021 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techomoro/28d2615e560fff95683554ebbfbc5cae to your computer and use it in GitHub Desktop.
Save techomoro/28d2615e560fff95683554ebbfbc5cae to your computer and use it in GitHub Desktop.
// store/posts/actions.js
import {
GET_POSTS,
GET_POSTS_SUCCESS,
GET_POSTS_FAIL,
GET_POST_DETAILS,
GET_POST_DETAILS_SUCCESS,
GET_POST_DETAILS_FAIL,
} from "./actionTypes";
export const getPosts = () => {
return {
type: GET_POSTS,
};
};
export const getPostsSuccess = (posts) => {
return {
type: GET_POSTS_SUCCESS,
payload: posts,
};
};
export const getPostsFail = (error) => {
return {
type: GET_POSTS_FAIL,
payload: error,
};
};
export const getPostDetails = (id) => {
return {
type: GET_POST_DETAILS,
payload: id,
};
};
export const getPostDetailsSuccess = (post) => {
return {
type: GET_POST_DETAILS_SUCCESS,
payload: post,
};
};
export const getPostDetailsFail = (error) => {
return {
type: GET_POST_DETAILS_FAIL,
payload: error,
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment