From d3d195470caef02891de58ed25b92a02c088c37d Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 16 Feb 2017 18:32:08 +0100 Subject: routes --- lib/okpush/index.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lib/okpush/index.js') diff --git a/lib/okpush/index.js b/lib/okpush/index.js index a9ba12eb..a509c891 100644 --- a/lib/okpush/index.js +++ b/lib/okpush/index.js @@ -69,6 +69,7 @@ function OKPush (options) { // pass in admin middleware! router.get('/admin', function (req, res) { + // change this to get notification counts for each channel db.getNotifications(function(err, notes){ db.getDeviceCount(function(err, count){ var data = { @@ -100,14 +101,17 @@ function OKPush (options) { // should work without middleware router.post('/add', function (req, res) { - // add a key - db. - registrationId: localStorage.getItem("yoox.registrationId"), - channel: channel, - platform, + db.addToken({ + token: req.body.registrationId, + channel: req.body.channel, + platform: req.body.platform, + }) }) router.post('/remove', function (req, res) { - // remove a key + db.removeToken({ + token: req.body.registrationId, + channel: req.body.channel, + }) }) this._router = router -- cgit v1.2.3-70-g09d2