aboutsummaryrefslogtreecommitdiff
path: root/src/web/js/actions/RightPanelActions.js
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-02-03 07:11:37 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-02-03 07:11:37 +0100
commitda929a367c3f1fe5f3546be82e47111c2fa84ad3 (patch)
tree89380f41b802256d8fdbf724e7d9e63b48209b4a /src/web/js/actions/RightPanelActions.js
parentMerge pull request #30 from jaesivsm/master (diff)
parentwriting a bit of doc, moving crawler together (diff)
downloadnewspipe-da929a367c3f1fe5f3546be82e47111c2fa84ad3.tar.gz
newspipe-da929a367c3f1fe5f3546be82e47111c2fa84ad3.tar.bz2
newspipe-da929a367c3f1fe5f3546be82e47111c2fa84ad3.zip
Merge pull request #31 from jaesivsm/master
redoing UI
Diffstat (limited to 'src/web/js/actions/RightPanelActions.js')
-rw-r--r--src/web/js/actions/RightPanelActions.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/web/js/actions/RightPanelActions.js b/src/web/js/actions/RightPanelActions.js
new file mode 100644
index 00000000..47adad79
--- /dev/null
+++ b/src/web/js/actions/RightPanelActions.js
@@ -0,0 +1,38 @@
+var jquery = require('jquery');
+var JarrDispatcher = require('../dispatcher/JarrDispatcher');
+var ActionTypes = require('../constants/JarrConstants');
+var MenuActions = require('../actions/MenuActions');
+
+var RightPanelActions = {
+ loadArticle: function(article_id, was_read_before) {
+ jquery.getJSON('/getart/' + article_id,
+ function(payload) {
+ JarrDispatcher.dispatch({
+ type: ActionTypes.LOAD_ARTICLE,
+ article: payload,
+ was_read_before: was_read_before,
+ });
+ }
+ );
+ },
+ _apiReq: function(meth, id, obj_type, data, success_callback) {
+ var args = {type: meth, contentType: 'application/json',
+ url: "api/v2.0/" + obj_type + "/" + id}
+ if(data) {args.data = JSON.stringify(data);}
+ if(success_callback) {args.success = success_callback;}
+ jquery.ajax(args);
+ },
+ putObj: function(id, obj_type, fields) {
+ this._apiReq('PUT', id, obj_type, fields, MenuActions.reload);
+ },
+ delObj: function(id, obj_type, fields) {
+ this._apiReq('DELETE', id, obj_type, null, MenuActions.reload);
+ },
+ resetErrors: function(feed_id) {
+ this._apiReq('PUT', feed_id, 'feed', {error_count: 0, last_error: ''},
+ MenuActions.reload);
+
+ },
+};
+
+module.exports = RightPanelActions;
bgstack15