UNPKG

@arc-publishing/sdk-identity

Version:
26 lines 1.18 kB
import { __assign, __awaiter, __generator } from "tslib"; import { headers } from './constants'; import { isAPIErrorResponse } from '../serviceHelpers/APIErrorResponse'; import Identity from './identity'; import JSONResponseHandler from '../serviceHelpers/JSONResponseHandler'; export var initAppleSignOn = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { return [2, fetch("".concat(Identity.apiOrigin, "/identity/public/v1/apple/authurl"), { method: 'GET', cache: 'no-cache', headers: __assign({}, headers) }) .then(JSONResponseHandler) .then(function (res) { if (isAPIErrorResponse(res)) { throw res; } else { var redirect = encodeURIComponent("".concat(Identity.apiOrigin, "/identity/public/v1/apple/auth")); window.location.href = "".concat(res, "&redirect_uri=").concat(redirect); } })]; }); }); }; export default initAppleSignOn; //# sourceMappingURL=initAppleSignOn.js.map