SHARE
TWEET

Untitled

a guest Apr 26th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { ActionCreator } from "./store.types";
  2. import { action } from "./store.utils";
  3.  
  4. /**
  5.  * Here we declare the application action names
  6.  */
  7. export enum ActionType {
  8.   GET_POSTS_REQUEST = "@@actions/GET_POSTS_REQUEST",
  9.   GET_POSTS_SUCCESS = "@@actions/GET_POSTS_SUCCESS",
  10.   DELETE_POST_REQUEST = "@@actions/DELETE_POST_REQUEST",
  11.   DELETE_POST_SUCCESS = "@@actions/DELETE_POST_SUCCESS"
  12. }
  13.  
  14. /**
  15.  * Action creators
  16.  */
  17. export const getPostsRequest: ActionCreator<void> = () =>
  18.   action<void>(ActionType.GET_POSTS_REQUEST);
  19.  
  20. export const getPostsSuccess: ActionCreator<any[]> = (posts: any[]) =>
  21.   action<any[]>(ActionType.GET_POSTS_SUCCESS, posts);
  22.  
  23. export const deletePostRequest: ActionCreator<string> = (postId: string) =>
  24.   action<string>(ActionType.DELETE_POST_REQUEST, postId);
  25.  
  26. export const deletePostSuccess: ActionCreator<string> = (postId: string) =>
  27.   action<string>(ActionType.DELETE_POST_SUCCESS, postId);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top