@como/como-client 0.1.8 → 0.1.9-1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/index.js +3 -0
- package/lib/como.js +2119 -492
- package/lib/config/env.js +19 -5
- package/lib/constants/resourceNames.js +3 -0
- package/lib/interceptors/refresh.js +92 -36
- package/lib/interceptors/response.js +46 -0
- package/lib/services/auth.service.js +212 -46
- package/lib/services/form.service.js +96 -0
- package/lib/services/index.js +25 -12
- package/lib/services/log.service.js +332 -0
- package/lib/services/loyalty.service.js +769 -14
- package/lib/services/ssr.service.js +75 -0
- package/lib/utils/comoExternalUrlTranslator.js +242 -0
- package/lib/utils/urls.js +27 -0
- package/package.json +16 -7
- package/src/como.js +930 -0
- package/.babelrc +0 -15
- package/.eslintignore +0 -1
- package/.eslintrc +0 -46
- package/.vscode/launch.json +0 -14
- package/como.js +0 -413
- package/webpack.config.js +0 -13
- package/yarn.lock +0 -5026
|
@@ -40,4 +40,100 @@ exports.getForm = function (service) {
|
|
|
40
40
|
return _ref.apply(this, arguments);
|
|
41
41
|
};
|
|
42
42
|
}();
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
exports.getConfiguration = function (service) {
|
|
46
|
+
return function () {
|
|
47
|
+
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(type, locationId) {
|
|
48
|
+
var url, _ref4, data;
|
|
49
|
+
|
|
50
|
+
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
|
51
|
+
while (1) {
|
|
52
|
+
switch (_context2.prev = _context2.next) {
|
|
53
|
+
case 0:
|
|
54
|
+
url = "/v1/config/" + type + "/" + locationId;
|
|
55
|
+
_context2.next = 3;
|
|
56
|
+
return service.get(url);
|
|
57
|
+
|
|
58
|
+
case 3:
|
|
59
|
+
_ref4 = _context2.sent;
|
|
60
|
+
data = _ref4.data;
|
|
61
|
+
return _context2.abrupt("return", data);
|
|
62
|
+
|
|
63
|
+
case 6:
|
|
64
|
+
case "end":
|
|
65
|
+
return _context2.stop();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}, _callee2, undefined);
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
return function (_x3, _x4) {
|
|
72
|
+
return _ref3.apply(this, arguments);
|
|
73
|
+
};
|
|
74
|
+
}();
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
exports.getResource = function (service) {
|
|
78
|
+
return function () {
|
|
79
|
+
var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(type, locationId, token) {
|
|
80
|
+
var url, _ref6, data;
|
|
81
|
+
|
|
82
|
+
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
|
83
|
+
while (1) {
|
|
84
|
+
switch (_context3.prev = _context3.next) {
|
|
85
|
+
case 0:
|
|
86
|
+
url = "/v1/resource/" + type + "/?tags=" + locationId + ",v1.0,GA";
|
|
87
|
+
_context3.next = 3;
|
|
88
|
+
return service.get(url);
|
|
89
|
+
|
|
90
|
+
case 3:
|
|
91
|
+
_ref6 = _context3.sent;
|
|
92
|
+
data = _ref6.data;
|
|
93
|
+
return _context3.abrupt("return", data);
|
|
94
|
+
|
|
95
|
+
case 6:
|
|
96
|
+
case "end":
|
|
97
|
+
return _context3.stop();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}, _callee3, undefined);
|
|
101
|
+
}));
|
|
102
|
+
|
|
103
|
+
return function (_x5, _x6, _x7) {
|
|
104
|
+
return _ref5.apply(this, arguments);
|
|
105
|
+
};
|
|
106
|
+
}();
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
exports.getZappResource = function (service) {
|
|
110
|
+
return function () {
|
|
111
|
+
var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(locationId) {
|
|
112
|
+
var url, _ref8, data;
|
|
113
|
+
|
|
114
|
+
return _regenerator2.default.wrap(function _callee4$(_context4) {
|
|
115
|
+
while (1) {
|
|
116
|
+
switch (_context4.prev = _context4.next) {
|
|
117
|
+
case 0:
|
|
118
|
+
url = "/v1/resource/zappResources/?tags=" + locationId;
|
|
119
|
+
_context4.next = 3;
|
|
120
|
+
return service.get(url);
|
|
121
|
+
|
|
122
|
+
case 3:
|
|
123
|
+
_ref8 = _context4.sent;
|
|
124
|
+
data = _ref8.data;
|
|
125
|
+
return _context4.abrupt("return", data);
|
|
126
|
+
|
|
127
|
+
case 6:
|
|
128
|
+
case "end":
|
|
129
|
+
return _context4.stop();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}, _callee4, undefined);
|
|
133
|
+
}));
|
|
134
|
+
|
|
135
|
+
return function (_x8) {
|
|
136
|
+
return _ref7.apply(this, arguments);
|
|
137
|
+
};
|
|
138
|
+
}();
|
|
43
139
|
};
|
package/lib/services/index.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var _keys = require('babel-runtime/core-js/object/keys');
|
|
4
|
+
|
|
5
|
+
var _keys2 = _interopRequireDefault(_keys);
|
|
6
|
+
|
|
3
7
|
var _extends2 = require('babel-runtime/helpers/extends');
|
|
4
8
|
|
|
5
9
|
var _extends3 = _interopRequireDefault(_extends2);
|
|
6
10
|
|
|
11
|
+
var _promise = require('babel-runtime/core-js/promise');
|
|
12
|
+
|
|
13
|
+
var _promise2 = _interopRequireDefault(_promise);
|
|
14
|
+
|
|
7
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
8
16
|
|
|
9
17
|
var axios = require('axios');
|
|
@@ -12,12 +20,16 @@ var _require = require('../interceptors/refresh'),
|
|
|
12
20
|
tokenInterceptor = _require.tokenInterceptor,
|
|
13
21
|
refreshInterceptor = _require.refreshInterceptor;
|
|
14
22
|
|
|
23
|
+
var _require2 = require('../interceptors/response'),
|
|
24
|
+
responseInterceptor = _require2.responseInterceptor;
|
|
25
|
+
|
|
15
26
|
var auth = require('./auth.service');
|
|
16
27
|
var loyalty = require('./loyalty.service');
|
|
17
28
|
var form = require('./form.service');
|
|
29
|
+
var ssr = require('./ssr.service');
|
|
18
30
|
|
|
19
|
-
exports.getService = function (baseURL, uid, getCredentials, credentialsRefresh) {
|
|
20
|
-
var
|
|
31
|
+
exports.getService = function (baseURL, uid, getCredentials, credentialsRefresh, source, locationId) {
|
|
32
|
+
var httpClient = axios.create({ baseURL: baseURL });
|
|
21
33
|
|
|
22
34
|
/**
|
|
23
35
|
* TODO: Make refresher prettier.
|
|
@@ -33,25 +45,26 @@ exports.getService = function (baseURL, uid, getCredentials, credentialsRefresh)
|
|
|
33
45
|
var _getCredentials = getCredentials(),
|
|
34
46
|
refreshToken = _getCredentials.refreshToken;
|
|
35
47
|
|
|
36
|
-
credentialsRefresh({
|
|
37
|
-
var refreshService = auth.refreshToken(
|
|
38
|
-
refreshPromise = refreshService(uid, refreshToken).then(function (creds) {
|
|
48
|
+
credentialsRefresh({ accessToken: false });
|
|
49
|
+
var refreshService = auth.refreshToken(httpClient, source);
|
|
50
|
+
refreshPromise = refreshService(uid, refreshToken, locationId).then(function (creds) {
|
|
39
51
|
refreshPromise = null;
|
|
40
|
-
credentialsRefresh(creds, true);
|
|
41
52
|
return creds;
|
|
42
53
|
});
|
|
43
54
|
return refreshPromise;
|
|
44
55
|
};
|
|
45
56
|
|
|
46
|
-
|
|
47
|
-
return
|
|
57
|
+
httpClient.interceptors.request.use(tokenInterceptor(getCredentials, refresher), function (err) {
|
|
58
|
+
return _promise2.default.reject(err);
|
|
48
59
|
});
|
|
49
|
-
|
|
50
|
-
var
|
|
60
|
+
httpClient.interceptors.response.use(responseInterceptor(credentialsRefresh), refreshInterceptor(refresher, httpClient));
|
|
61
|
+
var apiCalls = (0, _extends3.default)({}, auth, loyalty, form, ssr);
|
|
51
62
|
|
|
52
63
|
// Inject service instance to all service calls
|
|
53
|
-
|
|
54
|
-
prev[curr] =
|
|
64
|
+
var service = (0, _keys2.default)(apiCalls).reduce(function (prev, curr) {
|
|
65
|
+
prev[curr] = apiCalls[curr](httpClient); // eslint-disable-line no-param-reassign
|
|
55
66
|
return prev;
|
|
56
67
|
}, {});
|
|
68
|
+
|
|
69
|
+
return { service: service, refresher: refresher };
|
|
57
70
|
};
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _regenerator = require('babel-runtime/regenerator');
|
|
4
|
+
|
|
5
|
+
var _regenerator2 = _interopRequireDefault(_regenerator);
|
|
6
|
+
|
|
7
|
+
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
|
|
8
|
+
|
|
9
|
+
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
|
|
13
|
+
exports.signOn = function (service) {
|
|
14
|
+
return function () {
|
|
15
|
+
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(deviceId, locationId, refreshToken, source) {
|
|
16
|
+
var params, _ref2, data;
|
|
17
|
+
|
|
18
|
+
return _regenerator2.default.wrap(function _callee$(_context) {
|
|
19
|
+
while (1) {
|
|
20
|
+
switch (_context.prev = _context.next) {
|
|
21
|
+
case 0:
|
|
22
|
+
params = { deviceId: deviceId, locationId: locationId, refreshToken: refreshToken, source: source };
|
|
23
|
+
_context.next = 3;
|
|
24
|
+
return service.post('/auth/v2/auth/signOn', params);
|
|
25
|
+
|
|
26
|
+
case 3:
|
|
27
|
+
_ref2 = _context.sent;
|
|
28
|
+
data = _ref2.data;
|
|
29
|
+
return _context.abrupt('return', data);
|
|
30
|
+
|
|
31
|
+
case 6:
|
|
32
|
+
case 'end':
|
|
33
|
+
return _context.stop();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}, _callee, undefined);
|
|
37
|
+
}));
|
|
38
|
+
|
|
39
|
+
return function (_x, _x2, _x3, _x4) {
|
|
40
|
+
return _ref.apply(this, arguments);
|
|
41
|
+
};
|
|
42
|
+
}();
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
exports.register = function (service) {
|
|
46
|
+
return function () {
|
|
47
|
+
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(form, verification, reCaptchaToken) {
|
|
48
|
+
var source = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'App';
|
|
49
|
+
|
|
50
|
+
var _ref4, data;
|
|
51
|
+
|
|
52
|
+
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
|
53
|
+
while (1) {
|
|
54
|
+
switch (_context2.prev = _context2.next) {
|
|
55
|
+
case 0:
|
|
56
|
+
_context2.next = 2;
|
|
57
|
+
return service.post('/auth/v1/registration', { form: form, verification: verification, reCaptchaToken: reCaptchaToken, source: source });
|
|
58
|
+
|
|
59
|
+
case 2:
|
|
60
|
+
_ref4 = _context2.sent;
|
|
61
|
+
data = _ref4.data;
|
|
62
|
+
return _context2.abrupt('return', data);
|
|
63
|
+
|
|
64
|
+
case 5:
|
|
65
|
+
case 'end':
|
|
66
|
+
return _context2.stop();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, _callee2, undefined);
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
return function (_x5, _x6, _x7) {
|
|
73
|
+
return _ref3.apply(this, arguments);
|
|
74
|
+
};
|
|
75
|
+
}();
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
exports.registerVerify = function (service) {
|
|
79
|
+
return function () {
|
|
80
|
+
var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(verification, type, form, reCaptchaToken) {
|
|
81
|
+
var body, _ref6, data;
|
|
82
|
+
|
|
83
|
+
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
|
84
|
+
while (1) {
|
|
85
|
+
switch (_context3.prev = _context3.next) {
|
|
86
|
+
case 0:
|
|
87
|
+
body = { verification: verification, type: type, form: form, reCaptchaToken: reCaptchaToken };
|
|
88
|
+
_context3.next = 3;
|
|
89
|
+
return service.post('/auth/v1/registration/verify', body);
|
|
90
|
+
|
|
91
|
+
case 3:
|
|
92
|
+
_ref6 = _context3.sent;
|
|
93
|
+
data = _ref6.data;
|
|
94
|
+
return _context3.abrupt('return', data);
|
|
95
|
+
|
|
96
|
+
case 6:
|
|
97
|
+
case 'end':
|
|
98
|
+
return _context3.stop();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, _callee3, undefined);
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
return function (_x9, _x10, _x11, _x12) {
|
|
105
|
+
return _ref5.apply(this, arguments);
|
|
106
|
+
};
|
|
107
|
+
}();
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
exports.updateProfile = function (service) {
|
|
111
|
+
return function () {
|
|
112
|
+
var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(form, reCaptchaToken) {
|
|
113
|
+
var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'App';
|
|
114
|
+
|
|
115
|
+
var _ref8, data;
|
|
116
|
+
|
|
117
|
+
return _regenerator2.default.wrap(function _callee4$(_context4) {
|
|
118
|
+
while (1) {
|
|
119
|
+
switch (_context4.prev = _context4.next) {
|
|
120
|
+
case 0:
|
|
121
|
+
_context4.next = 2;
|
|
122
|
+
return service.post('/auth/v1/update-profile', { form: form, source: source, reCaptchaToken: reCaptchaToken });
|
|
123
|
+
|
|
124
|
+
case 2:
|
|
125
|
+
_ref8 = _context4.sent;
|
|
126
|
+
data = _ref8.data;
|
|
127
|
+
return _context4.abrupt('return', data);
|
|
128
|
+
|
|
129
|
+
case 5:
|
|
130
|
+
case 'end':
|
|
131
|
+
return _context4.stop();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}, _callee4, undefined);
|
|
135
|
+
}));
|
|
136
|
+
|
|
137
|
+
return function (_x13, _x14) {
|
|
138
|
+
return _ref7.apply(this, arguments);
|
|
139
|
+
};
|
|
140
|
+
}();
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
exports.updateProfileVerify = function (service) {
|
|
144
|
+
return function () {
|
|
145
|
+
var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(code, type, form, reCaptchaToken) {
|
|
146
|
+
var source = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'App';
|
|
147
|
+
|
|
148
|
+
var body, _ref10, data;
|
|
149
|
+
|
|
150
|
+
return _regenerator2.default.wrap(function _callee5$(_context5) {
|
|
151
|
+
while (1) {
|
|
152
|
+
switch (_context5.prev = _context5.next) {
|
|
153
|
+
case 0:
|
|
154
|
+
body = { code: code, type: type, form: form, source: source, reCaptchaToken: reCaptchaToken };
|
|
155
|
+
_context5.next = 3;
|
|
156
|
+
return service.post('/auth/v1/update-profile/verify', body);
|
|
157
|
+
|
|
158
|
+
case 3:
|
|
159
|
+
_ref10 = _context5.sent;
|
|
160
|
+
data = _ref10.data;
|
|
161
|
+
return _context5.abrupt('return', data);
|
|
162
|
+
|
|
163
|
+
case 6:
|
|
164
|
+
case 'end':
|
|
165
|
+
return _context5.stop();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}, _callee5, undefined);
|
|
169
|
+
}));
|
|
170
|
+
|
|
171
|
+
return function (_x16, _x17, _x18, _x19) {
|
|
172
|
+
return _ref9.apply(this, arguments);
|
|
173
|
+
};
|
|
174
|
+
}();
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
exports.unsubscribeSms = function (service) {
|
|
178
|
+
return function () {
|
|
179
|
+
var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(locationId, identifier) {
|
|
180
|
+
var body, _ref12, data;
|
|
181
|
+
|
|
182
|
+
return _regenerator2.default.wrap(function _callee6$(_context6) {
|
|
183
|
+
while (1) {
|
|
184
|
+
switch (_context6.prev = _context6.next) {
|
|
185
|
+
case 0:
|
|
186
|
+
body = { locationId: locationId, identifier: identifier };
|
|
187
|
+
_context6.next = 3;
|
|
188
|
+
return service.post('/auth/v1/update-profile/unsubscribeSms', body);
|
|
189
|
+
|
|
190
|
+
case 3:
|
|
191
|
+
_ref12 = _context6.sent;
|
|
192
|
+
data = _ref12.data;
|
|
193
|
+
return _context6.abrupt('return', data);
|
|
194
|
+
|
|
195
|
+
case 6:
|
|
196
|
+
case 'end':
|
|
197
|
+
return _context6.stop();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}, _callee6, undefined);
|
|
201
|
+
}));
|
|
202
|
+
|
|
203
|
+
return function (_x21, _x22) {
|
|
204
|
+
return _ref11.apply(this, arguments);
|
|
205
|
+
};
|
|
206
|
+
}();
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
exports.logIn = function (service) {
|
|
210
|
+
return function () {
|
|
211
|
+
var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(type, identifier) {
|
|
212
|
+
var params, _ref14, data;
|
|
213
|
+
|
|
214
|
+
return _regenerator2.default.wrap(function _callee7$(_context7) {
|
|
215
|
+
while (1) {
|
|
216
|
+
switch (_context7.prev = _context7.next) {
|
|
217
|
+
case 0:
|
|
218
|
+
params = { type: type, identifier: identifier };
|
|
219
|
+
_context7.next = 3;
|
|
220
|
+
return service.post('/auth/v1/auth/logIn', params);
|
|
221
|
+
|
|
222
|
+
case 3:
|
|
223
|
+
_ref14 = _context7.sent;
|
|
224
|
+
data = _ref14.data;
|
|
225
|
+
return _context7.abrupt('return', data);
|
|
226
|
+
|
|
227
|
+
case 6:
|
|
228
|
+
case 'end':
|
|
229
|
+
return _context7.stop();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}, _callee7, undefined);
|
|
233
|
+
}));
|
|
234
|
+
|
|
235
|
+
return function (_x23, _x24) {
|
|
236
|
+
return _ref13.apply(this, arguments);
|
|
237
|
+
};
|
|
238
|
+
}();
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
exports.logInVerify = function (service) {
|
|
242
|
+
return function () {
|
|
243
|
+
var _ref15 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(code, type, identifier) {
|
|
244
|
+
var params, _ref16, data;
|
|
245
|
+
|
|
246
|
+
return _regenerator2.default.wrap(function _callee8$(_context8) {
|
|
247
|
+
while (1) {
|
|
248
|
+
switch (_context8.prev = _context8.next) {
|
|
249
|
+
case 0:
|
|
250
|
+
params = {
|
|
251
|
+
identifier: identifier,
|
|
252
|
+
code: code,
|
|
253
|
+
type: type
|
|
254
|
+
};
|
|
255
|
+
_context8.next = 3;
|
|
256
|
+
return service.post('/auth/v1/auth/logInVerify', params);
|
|
257
|
+
|
|
258
|
+
case 3:
|
|
259
|
+
_ref16 = _context8.sent;
|
|
260
|
+
data = _ref16.data;
|
|
261
|
+
return _context8.abrupt('return', data);
|
|
262
|
+
|
|
263
|
+
case 6:
|
|
264
|
+
case 'end':
|
|
265
|
+
return _context8.stop();
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}, _callee8, undefined);
|
|
269
|
+
}));
|
|
270
|
+
|
|
271
|
+
return function (_x25, _x26, _x27) {
|
|
272
|
+
return _ref15.apply(this, arguments);
|
|
273
|
+
};
|
|
274
|
+
}();
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
exports.logOut = function (service) {
|
|
278
|
+
return (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9() {
|
|
279
|
+
var _ref18, data;
|
|
280
|
+
|
|
281
|
+
return _regenerator2.default.wrap(function _callee9$(_context9) {
|
|
282
|
+
while (1) {
|
|
283
|
+
switch (_context9.prev = _context9.next) {
|
|
284
|
+
case 0:
|
|
285
|
+
_context9.next = 2;
|
|
286
|
+
return service.post('/auth/v1/auth/logOut');
|
|
287
|
+
|
|
288
|
+
case 2:
|
|
289
|
+
_ref18 = _context9.sent;
|
|
290
|
+
data = _ref18.data;
|
|
291
|
+
return _context9.abrupt('return', data);
|
|
292
|
+
|
|
293
|
+
case 5:
|
|
294
|
+
case 'end':
|
|
295
|
+
return _context9.stop();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}, _callee9, undefined);
|
|
299
|
+
}));
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
exports.refreshToken = function (service, source) {
|
|
303
|
+
return function () {
|
|
304
|
+
var _ref19 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(uid, token) {
|
|
305
|
+
var params, _ref20, data;
|
|
306
|
+
|
|
307
|
+
return _regenerator2.default.wrap(function _callee10$(_context10) {
|
|
308
|
+
while (1) {
|
|
309
|
+
switch (_context10.prev = _context10.next) {
|
|
310
|
+
case 0:
|
|
311
|
+
params = { uid: uid, refreshToken: token, source: source };
|
|
312
|
+
_context10.next = 3;
|
|
313
|
+
return service.post('/auth/v1/auth/refresh-token', params);
|
|
314
|
+
|
|
315
|
+
case 3:
|
|
316
|
+
_ref20 = _context10.sent;
|
|
317
|
+
data = _ref20.data;
|
|
318
|
+
return _context10.abrupt('return', data);
|
|
319
|
+
|
|
320
|
+
case 6:
|
|
321
|
+
case 'end':
|
|
322
|
+
return _context10.stop();
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}, _callee10, undefined);
|
|
326
|
+
}));
|
|
327
|
+
|
|
328
|
+
return function (_x28, _x29) {
|
|
329
|
+
return _ref19.apply(this, arguments);
|
|
330
|
+
};
|
|
331
|
+
}();
|
|
332
|
+
};
|