Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //first import an instance of Alt, which we will use to create actions and stores.
- import alt from '../alt';
- class MyComponentActions {
- constructor() {
- //handlers for these actions will be defined in the store.
- this.generateActions(
- 'getMyMembersSuccess',
- 'getMyMembersFail'
- );
- }
- getMyMembers() {
- //fetch our members from the backend through some API endpoint
- $.ajax({url: '/api/v1/members'})
- .done((data) => {
- this.actions.getMyMembersSuccess(data)
- });
- .fail((jqXhr) => {
- this.actions.getMyMembersFail(jqxhr)
- });
- }
- }
- export default alt.createActions(FooterActions);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement