@arc-publishing/sdk-amp
Version:
Arc AMP SDK to work with Google AMP Pages
31 lines • 1.35 kB
JavaScript
import { __awaiter, __generator } from "tslib";
import JSONResponseHandler from '@arc-publishing/sdk-subs-core/lib/utils/JSONResponseHandler';
import { headers } from './constants';
import { getOptions, getValidURL } from './utils';
import AMP from './amp';
export default function getAMPReaderIDs() {
return __awaiter(this, void 0, void 0, function () {
var options, url;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, getOptions({ method: 'GET', headers: headers })];
case 1:
options = _a.sent();
url = typeof window !== 'undefined' ? getValidURL(AMP.apiOrigin) : AMP.apiOrigin;
return [2, fetch("".concat(url, "/sales/public/v1/amp"), options)
.then(function (res) {
return JSONResponseHandler(res);
})
.then(function (json) {
if (json && Array.isArray(json)) {
return json;
}
else {
throw json;
}
})];
}
});
});
}
//# sourceMappingURL=getAMPReaderIDs.js.map