From b484e2754bbae5f20bc1721a583c34c2adcb31ac Mon Sep 17 00:00:00 2001 From: Ivan Socolsky <jungans@gmail.com> Date: Fri, 3 Feb 2017 14:35:05 -0300 Subject: [PATCH] unsubscribe v2 --- lib/expressapp.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/expressapp.js b/lib/expressapp.js index bfc402b..cd06558 100644 --- a/lib/expressapp.js +++ b/lib/expressapp.js @@ -672,9 +672,25 @@ ExpressApp.prototype.start = function(opts, cb) { }); }); + // DEPRECATED router.delete('/v1/pushnotifications/subscriptions/', function(req, res) { + logDeprecated(req); + getServerWithAuth(req, res, function(server) { + server.pushNotificationsUnsubscribe({ + token: 'dummy' + }, function(err, response) { + if (err) return returnError(err, res, req); + res.json(response); + }); + }); + }); + + router.delete('/v2/pushnotifications/subscriptions/:token', function(req, res) { + var opts = { + token: req.params['token'], + }; getServerWithAuth(req, res, function(server) { - server.pushNotificationsUnsubscribe(function(err, response) { + server.pushNotificationsUnsubscribe(opts, function(err, response) { if (err) return returnError(err, res, req); res.json(response); });