Skip to content

Instantly share code, notes, and snippets.

@rogaldh
Forked from koistya/AppActions.js
Last active August 29, 2015 14:13
Show Gist options
  • Save rogaldh/a52e231b7e65de22bfc4 to your computer and use it in GitHub Desktop.
Save rogaldh/a52e231b7e65de22bfc4 to your computer and use it in GitHub Desktop.
/*
* 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)
.accept('application/json')
.end((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