mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
Used ajax when canceling from the website (#8697)
* Used ajax when canceling from the website * Fixed grammar issue
This commit is contained in:
committed by
Sabe Jones
parent
773d546e4f
commit
8c8f0ea201
@@ -326,11 +326,23 @@ function($rootScope, User, $http, Content) {
|
||||
paymentMethod = paymentMethod.toLowerCase();
|
||||
}
|
||||
|
||||
var cancelUrl = '/' + paymentMethod + '/subscribe/cancel?_id=' + User.user._id + '&apiToken=' + User.settings.auth.apiToken;
|
||||
var queryParams = {
|
||||
_id: User.user._id,
|
||||
apiToken: User.settings.auth.apiToken,
|
||||
noRedirect: true,
|
||||
};
|
||||
|
||||
if (group) {
|
||||
cancelUrl += '&groupId=' + group._id;
|
||||
queryParams.groupId = group._id;
|
||||
}
|
||||
window.location.href = cancelUrl;
|
||||
|
||||
var cancelUrl = '/' + paymentMethod + '/subscribe/cancel?' + $.param(queryParams);
|
||||
|
||||
$http.get(cancelUrl)
|
||||
.then(function (success) {
|
||||
alert(window.evn.t('paypalCanceled'));
|
||||
window.location.href = '/';
|
||||
});
|
||||
}
|
||||
|
||||
Payments.encodeGift = function(uuid, gift) {
|
||||
|
||||
Reference in New Issue
Block a user