Repository URL to install this package:
|
Version:
2.0.0-rc.6 ▾
|
'use strict';
const fetch = require('fetch-everywhere');
const {
errorHandler,
responseHandler
} = require('./helpers/fetch');
/**
* Get all subscriptions for a user.
*
* @param {string} accessToken - The user's JWT access token
* @returns {Promise}
*/
function getAllSubscriptionsForUser(accessToken) {
if (typeof accessToken !== 'string') {
throw new TypeError(`accessToken param must be a string, got ${typeof accessToken}`);
}
const url = `${process.env.SVC_BILLING_BASE_URL}/subscriptions/list`;
const headers = {
'Content-Type': 'application/json',
Accept: 'application/json',
Authorization: `Bearer ${accessToken}`
};
return fetch(url, {
method: 'GET',
headers
}).then(responseHandler).catch(errorHandler);
}
module.exports = getAllSubscriptionsForUser;
//# sourceMappingURL=getAllSubscriptionsForUser.js.map