Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- t.b = function(e) {
- var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
- n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "",
- c = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : r.default.sequence();
- return function(e) {
- var t = void 0;
- return o[e] = new Promise(function(n) {
- t = (o[e] || Promise.resolve(void 0)).then(function(e) {
- return {
- token: e,
- resolveRequest: function(e) {
- return n(e)
- }
- }
- })
- }), t
- }(e).then(function(o) {
- var l = o.token,
- u = o.resolveRequest;
- return fetch(e, Object.assign({
- method: "POST",
- cache: "no-cache",
- body: JSON.stringify(Object.assign({
- version: 3,
- seq: c,
- location: n
- }, t, l && {
- token: l
- })),
- headers: a({
- sid: r.default.sid
- })
- })).then(function(e) {
- return e.json().then(function(t) {
- var n = e.headers.get("x-session-id"),
- i = t.errors,
- a = t.flow_id,
- o = t.state_id,
- s = t.token;
- return i ? (u(s), Promise.reject({
- errors: i,
- state_id: o
- })) : r.default.refresh(Object.assign({}, t.session, {
- sid: n
- })) ? (u(s), Object.assign({}, t.response, o && {
- state_id: o
- }, a && {
- flow_id: a
- }, s && {
- token: s
- })) : new Promise
- })
- }, function(e) {
- throw u(), new s(e)
- }).then(function(e) {
- return e
- }).then(i.default)
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment