Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. //first import an instance of Alt, which we will use to create actions and stores.
  2. import alt from '../alt';
  3.  
  4. class MyComponentActions {
  5. constructor() {
  6. //handlers for these actions will be defined in the store.
  7. this.generateActions(
  8. 'getMyMembersSuccess',
  9. 'getMyMembersFail'
  10. );
  11. }
  12.  
  13. getMyMembers() {
  14. //fetch our members from the backend through some API endpoint
  15. $.ajax({url: '/api/v1/members'})
  16. .done((data) => {
  17. this.actions.getMyMembersSuccess(data)
  18. });
  19. .fail((jqXhr) => {
  20. this.actions.getMyMembersFail(jqxhr)
  21. });
  22. }
  23. }
  24.  
  25. export default alt.createActions(FooterActions);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement