@jetthai/cuora 1.0.75 → 1.0.76

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.76](https://github.com/jetthai/cuora-module/compare/v1.0.75...v1.0.76) (2022-01-11)
6
+
5
7
  ### [1.0.75](https://github.com/jetthai/cuora-module/compare/v1.0.74...v1.0.75) (2022-01-07)
6
8
 
7
9
  ### [1.0.74](https://github.com/jetthai/cuora-module/compare/v1.0.73...v1.0.74) (2022-01-06)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.75",
3
+ "version": "1.0.76",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -82,7 +82,7 @@ export default function (request) {
82
82
  actions: ['setUserInfo', 'extendToken', send({ type: 'CHECK' })],
83
83
  },
84
84
  onError: {
85
- target: '#auth.logout',
85
+ target: '#auth.leaving',
86
86
  },
87
87
  },
88
88
  },
@@ -109,23 +109,30 @@ export default function (request) {
109
109
  },
110
110
  on: {
111
111
  LOGOUT: {
112
- target: '#auth.logout',
112
+ target: '#auth.leaving',
113
113
  },
114
114
  },
115
115
  },
116
- logout: {
116
+ leaving: {
117
117
  invoke: {
118
118
  src: 'logout',
119
119
  onDone: {
120
- target: 'idle',
120
+ target: 'logout',
121
121
  actions: 'removeToken',
122
122
  },
123
123
  onError: {
124
- target: 'idle',
124
+ target: 'logout',
125
125
  actions: 'removeToken',
126
126
  },
127
127
  },
128
128
  },
129
+ logout: {
130
+ after: {
131
+ 0: {
132
+ target: 'idle',
133
+ },
134
+ },
135
+ },
129
136
  },
130
137
  },
131
138
  {
@@ -210,14 +217,15 @@ export default function (request) {
210
217
  return { token }
211
218
  }),
212
219
  redirectTo3Party: (context, event) => {
220
+ const { provider, channel = 'official', subchannel = 'pwa' } = event.data
213
221
  const redirectURL = urljoin(
214
222
  request.config.fullURL,
215
223
  'login?' +
216
224
  qs.stringify({
217
- provider: event.data,
225
+ provider,
218
226
  redirectURI: `${window.location.protocol}//${window.location.host}`,
219
- channel: 'official',
220
- subchannel: 'pwa',
227
+ channel,
228
+ subchannel,
221
229
  })
222
230
  )
223
231
  window.location.href = redirectURL
@@ -9,6 +9,8 @@ export default function (request) {
9
9
  context: {
10
10
  email: '',
11
11
  password: '',
12
+ channel: null,
13
+ subchannel: null,
12
14
  },
13
15
  states: {
14
16
  idle: {
@@ -67,10 +69,12 @@ export default function (request) {
67
69
  {
68
70
  actions: {
69
71
  setForm: assign((context, event) => {
70
- const { email, password } = event.data
72
+ const { email, password, channel, subchannel } = event.data
71
73
  return {
72
74
  email,
73
75
  password,
76
+ channel,
77
+ subchannel,
74
78
  }
75
79
  }),
76
80
  },
@@ -84,8 +88,8 @@ export default function (request) {
84
88
  },
85
89
  services: {
86
90
  signUp: async (context, event) => {
87
- const { email, password } = context
88
- return await request.send(auth.register({ provider: 'email', email, password }))
91
+ const { email, password, channel, subchannel } = context
92
+ return await request.send(auth.register({ provider: 'email', email, password, channel, subchannel }))
89
93
  },
90
94
  },
91
95
  }
@@ -71,14 +71,6 @@ export default class Request {
71
71
 
72
72
  _createConfig(req, cancelToken) {
73
73
  const { method, url, params, isPublic, isFormData } = req
74
- // const config = { baseURL: this.config.fullURL, method, url, cancelToken, isPublic: req.isPublic }
75
- // if (method.toUpperCase() === 'GET') {
76
- // config.params = pickBy(params, isValid)
77
- // } else {
78
- // config.data = pickBy(params, isValid)
79
- // }
80
- // return config
81
-
82
74
  if (isFormData) {
83
75
  return {
84
76
  baseURL: this.config.fullURL,