@jetthai/cuora 1.0.181 → 1.0.182
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/CHANGELOG.md +2 -0
- package/package.json +1 -1
- package/src/api/auth.js +15 -0
- package/src/machine/auth.js +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.0.182](https://github.com/jetthai/cuora-module/compare/v1.0.181...v1.0.182) (2022-10-03)
|
|
6
|
+
|
|
5
7
|
### [1.0.181](https://github.com/jetthai/cuora-module/compare/v1.0.180...v1.0.181) (2022-09-29)
|
|
6
8
|
|
|
7
9
|
### [1.0.180](https://github.com/jetthai/cuora-module/compare/v1.0.179...v1.0.180) (2022-09-28)
|
package/package.json
CHANGED
package/src/api/auth.js
CHANGED
|
@@ -11,6 +11,21 @@ export default {
|
|
|
11
11
|
isPublic: true,
|
|
12
12
|
headers: { 'x-access-captcha': reCaptchaToken },
|
|
13
13
|
}),
|
|
14
|
+
loginApp: ({ id, provider, displayName, pictureUrl, accessToken }) => ({
|
|
15
|
+
url: 'appLogin',
|
|
16
|
+
method: 'post',
|
|
17
|
+
params: {
|
|
18
|
+
provider,
|
|
19
|
+
data: {
|
|
20
|
+
id,
|
|
21
|
+
provider,
|
|
22
|
+
displayName,
|
|
23
|
+
pictureUrl,
|
|
24
|
+
accessToken,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
isPublic: true,
|
|
28
|
+
}),
|
|
14
29
|
register: ({ channel = 'official', subchannel = 'pwa', reCaptchaToken, dt, ...rest }) => ({
|
|
15
30
|
url: `register?channel=${channel}&subchannel=${subchannel}`,
|
|
16
31
|
method: 'post',
|
package/src/machine/auth.js
CHANGED
|
@@ -67,6 +67,19 @@ export default function (request) {
|
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
69
|
},
|
|
70
|
+
authenticationApp: {
|
|
71
|
+
invoke: {
|
|
72
|
+
src: 'authenticateApp',
|
|
73
|
+
onDone: {
|
|
74
|
+
target: 'authenticated',
|
|
75
|
+
actions: ['setToken'],
|
|
76
|
+
},
|
|
77
|
+
onError: {
|
|
78
|
+
target: 'idle',
|
|
79
|
+
actions: 'removeToken',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
70
83
|
authenticated: {
|
|
71
84
|
invoke: {
|
|
72
85
|
src: 'fetchUserInfo',
|
|
@@ -179,6 +192,9 @@ export default function (request) {
|
|
|
179
192
|
LOGIN_3PARTY: {
|
|
180
193
|
actions: 'redirectTo3Party',
|
|
181
194
|
},
|
|
195
|
+
LOGIN_APP: {
|
|
196
|
+
actions: '.authenticationApp'
|
|
197
|
+
},
|
|
182
198
|
SET_PLAY: {
|
|
183
199
|
actions: 'setPlay',
|
|
184
200
|
},
|
|
@@ -337,6 +353,10 @@ export default function (request) {
|
|
|
337
353
|
}),
|
|
338
354
|
},
|
|
339
355
|
services: {
|
|
356
|
+
authenticateApp: async (context, event) => {
|
|
357
|
+
const { token } = await request.send(auth.loginApp(event.data))
|
|
358
|
+
return token
|
|
359
|
+
},
|
|
340
360
|
authenticate: async (context, event) => {
|
|
341
361
|
const data = { ...context.loginData, reCaptchaToken: context.reCaptchaToken }
|
|
342
362
|
const { token } = await request.send(auth.login(data))
|