Repository URL to install this package:
|
Version:
2.0.0-rc.7 ▾
|
'use strict';
const fetch = require('fetch-everywhere');
const {
errorHandler,
responseHandler
} = require('./helpers/fetch');
/**
* Get active subscriptions for a user.
*
* @param {string} accessToken - The user's access-token
* @returns {Object}
*/
function getActiveSubscriptionsForUser(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`;
const headers = {
'Content-Type': 'application/json',
Authorization: `Bearer ${accessToken}`,
Accept: 'application/json'
};
return fetch(url, {
method: 'GET',
headers
}).then(responseHandler).catch(errorHandler);
}
module.exports = getActiveSubscriptionsForUser;
//# sourceMappingURL=getActiveSubscriptionsForUser.js.map