Created
October 6, 2021 10:23
-
-
Save techomoro/28d2615e560fff95683554ebbfbc5cae 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
// 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