UNPKG

@arc-publishing/sdk-identity

Version:
30 lines 1.47 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.initAppleSignOn = void 0; var tslib_1 = require("tslib"); var constants_1 = require("./constants"); var APIErrorResponse_1 = require("../serviceHelpers/APIErrorResponse"); var identity_1 = tslib_1.__importDefault(require("./identity")); var JSONResponseHandler_1 = tslib_1.__importDefault(require("../serviceHelpers/JSONResponseHandler")); var initAppleSignOn = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { return [2, fetch("".concat(identity_1.default.apiOrigin, "/identity/public/v1/apple/authurl"), { method: 'GET', cache: 'no-cache', headers: tslib_1.__assign({}, constants_1.headers) }) .then(JSONResponseHandler_1.default) .then(function (res) { if ((0, APIErrorResponse_1.isAPIErrorResponse)(res)) { throw res; } else { var redirect = encodeURIComponent("".concat(identity_1.default.apiOrigin, "/identity/public/v1/apple/auth")); window.location.href = "".concat(res, "&redirect_uri=").concat(redirect); } })]; }); }); }; exports.initAppleSignOn = initAppleSignOn; exports.default = exports.initAppleSignOn; //# sourceMappingURL=initAppleSignOn.js.map