Last active
August 29, 2015 14:13
-
-
Save koistya/8d109be141d138e8d880 to your computer and use it in GitHub Desktop.
You might not need XXX_SUCCESS, XXX_ERROR for each of your action types in Flux / ReactJS apps.
This file contains hidden or 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
/* | |
* React.js Starter Kit | |
* Copyright (c) 2014 Konstantin Tarkus (@koistya), KriaSoft LLC. | |
*/ | |
'use strict'; | |
var Dispatcher = require('../core/Dispatcher'); | |
var ActionTypes = require('../constants/ActionTypes'); | |
var SourceTypes = require('../constants/SourceTypes') | |
var http = require('superagent'); | |
module.exports = { | |
loadPage(path) { | |
Dispatcher.handleViewAction({ | |
actionType: ActionTypes.LOAD_PAGE, path: path | |
}); | |
http.get('/api/page' + path, (err, res) => { | |
Dispatcher.handleServerAction({ | |
actionType: ActionTypes.LOAD_PAGE, path: path, err: err, page: res | |
}); | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment