@jetthai/cuora 1.0.39 → 1.0.40

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 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.40](https://github.com/jetthai/cuora-module/compare/v1.0.39...v1.0.40) (2021-11-11)
6
+
5
7
  ### [1.0.39](https://github.com/jetthai/cuora-module/compare/v1.0.38...v1.0.39) (2021-11-09)
6
8
 
7
9
  ### [1.0.38](https://github.com/jetthai/cuora-module/compare/v1.0.37...v1.0.38) (2021-11-05)
package/README.md CHANGED
@@ -11,9 +11,17 @@ npm install --save @jetthai/cuora
11
11
  Add config in `nuxt.config.js` to support latest ECMAScript.
12
12
  ```js
13
13
  // nuxt.config.js
14
+ {
15
+ ssr: false
16
+ }
17
+ ```
18
+ ```js
19
+ // nuxt.config.js
14
20
  {
15
21
  build: {
16
22
  transpile: '@jetthai/cuora'
17
23
  }
18
24
  }
19
- ```
25
+ ```
26
+
27
+ ## Usage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
package/src/api/auth.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export default {
2
- login: ({ username, password, provider, countryCode, phone }) => ({
2
+ login: ({ username, password, provider, countryCode, phone, email }) => ({
3
3
  url: 'login',
4
4
  method: 'post',
5
- params: { username, password, provider, countryCode, phone },
5
+ params: { username, password, provider, countryCode, phone, email },
6
6
  isPublic: true,
7
7
  }),
8
8
  register: (data) => ({
@@ -30,6 +30,9 @@ export default function (request) {
30
30
  LOGIN_PHONE: {
31
31
  target: 'authentication.phone',
32
32
  },
33
+ LOGIN_EMAIL: {
34
+ target: 'authentication.email',
35
+ },
33
36
  LOGIN_LOCAL: {
34
37
  target: 'authentication.local',
35
38
  },
@@ -69,6 +72,19 @@ export default function (request) {
69
72
  },
70
73
  },
71
74
  },
75
+ email: {
76
+ invoke: {
77
+ src: 'authenticateByEmail',
78
+ onDone: {
79
+ target: '#auth.login',
80
+ actions: 'setToken',
81
+ },
82
+ onError: {
83
+ target: '#auth.idle',
84
+ actions: 'removeToken',
85
+ },
86
+ },
87
+ },
72
88
  },
73
89
  },
74
90
  login: {
@@ -211,6 +227,11 @@ export default function (request) {
211
227
  const { token } = await request.send(auth.login({ provider: 'phone', countryCode, phone, password }))
212
228
  return token
213
229
  },
230
+ authenticateByEmail: async (context, event) => {
231
+ const { email, password } = event.data
232
+ const { token } = await request.send(auth.login({ provider: 'email', email, password }))
233
+ return token
234
+ },
214
235
  logout: async (context, event) => {
215
236
  return await request.send(auth.logout())
216
237
  },