Skip to content

Commit 9fdb1ee

Browse files
committed
Creating Dispatcher
1 parent ad4eb67 commit 9fdb1ee

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

src/actions/authorActions.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"use strict";
2+
3+
var Dispatcher = require('../dispatcher/appDispatcher');
4+
var AuthorApi = require('../api/authorApi');
5+
6+
var AuthorActions = {
7+
createAuthor: function(author){
8+
var newAuthor = AuthorApi.saveAuthor(author);
9+
10+
Dispatcher.dispatch({
11+
actionType:
12+
author:
13+
})
14+
}
15+
}
16+
17+
module.exports = AuthorActions;

src/constants/actionTypes.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"use strinct";
2+
3+
var keyMirror = require('react/lib/keyMirror');
4+
5+
module.exports = keyMirror({
6+
CREATE_AUTHOR: null
7+
});

src/dispatcher/appDispatcher.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
var Dispatcher = require('flux').Dispatcher;
4+
5+
module.exports = new Dispatcher;

0 commit comments

Comments
 (0)