@jetthai/cuora 1.0.21 → 1.0.22
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/plugin/job/network.js +3 -1
- package/plugin/payment.js +2 -2
- package/plugin/request.js +6 -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.22](https://github.com/jetthai/cuora-module/compare/v1.0.21...v1.0.22) (2021-08-25)
|
|
6
|
+
|
|
5
7
|
### [1.0.21](https://github.com/jetthai/cuora-module/compare/v1.0.20...v1.0.21) (2021-08-23)
|
|
6
8
|
|
|
7
9
|
### [1.0.20](https://github.com/jetthai/cuora-module/compare/v1.0.19...v1.0.20) (2021-08-23)
|
package/package.json
CHANGED
package/plugin/job/network.js
CHANGED
|
@@ -3,6 +3,7 @@ export default async ({ $request }, inject) => {
|
|
|
3
3
|
if (!$request.config) {
|
|
4
4
|
throw Error('network plugin must be after CuoraConfig module')
|
|
5
5
|
}
|
|
6
|
+
// todo - prod bucket name btc-storage-rd / btc-storage-prod
|
|
6
7
|
const url = `https://storage.googleapis.com/btc-storage-rd/site_resources/${$request.config.clientId}/target/target.json`
|
|
7
8
|
const networkTester = new NetworkTester(url)
|
|
8
9
|
$request.config.apiURL = await networkTester.test()
|
|
@@ -40,7 +41,8 @@ class NetworkTester {
|
|
|
40
41
|
return url
|
|
41
42
|
} catch (error) {
|
|
42
43
|
console.error('[Network] Network Test Fail.', error)
|
|
43
|
-
return
|
|
44
|
+
// todo - return default apiURL
|
|
45
|
+
return
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
|
package/plugin/payment.js
CHANGED
|
@@ -205,7 +205,7 @@ function createStore({ $request }) {
|
|
|
205
205
|
try {
|
|
206
206
|
commit(`core/setLoading`, true, { root: true })
|
|
207
207
|
const { data } = await this.call('exchange', { appSecret: clientSecret, ...exchangeTarget })
|
|
208
|
-
await dispatch('getActivityDetail', exchangeTarget.activityNo, { root: true })
|
|
208
|
+
await dispatch('activity/getActivityDetail', exchangeTarget.activityNo, { root: true })
|
|
209
209
|
commit(`core/setLoading`, false, { root: true })
|
|
210
210
|
return data
|
|
211
211
|
} catch (err) {
|
|
@@ -214,7 +214,7 @@ function createStore({ $request }) {
|
|
|
214
214
|
},
|
|
215
215
|
async collect({ commit, dispatch }, activityNo) {
|
|
216
216
|
const { data } = await $request.sendWithLoading(api.collect({ appSecret: clientSecret }))
|
|
217
|
-
await dispatch('getActivityDetail', activityNo, { root: true })
|
|
217
|
+
await dispatch('activity/getActivityDetail', activityNo, { root: true })
|
|
218
218
|
},
|
|
219
219
|
async setBonusSetting({ commit, dispatch }, data) {
|
|
220
220
|
return await $request.sendWithLoading(api.setBonusSetting({ bonus: data }))
|
package/plugin/request.js
CHANGED
|
@@ -99,6 +99,7 @@ class Request {
|
|
|
99
99
|
this.source = axios.CancelToken.source()
|
|
100
100
|
this.config = config
|
|
101
101
|
this.cookie = cookie
|
|
102
|
+
this.errorHandler = null
|
|
102
103
|
this.initialize()
|
|
103
104
|
}
|
|
104
105
|
|
|
@@ -128,6 +129,10 @@ class Request {
|
|
|
128
129
|
)
|
|
129
130
|
}
|
|
130
131
|
|
|
132
|
+
setErrorHandler(handler) {
|
|
133
|
+
this.errorHandler = handler
|
|
134
|
+
}
|
|
135
|
+
|
|
131
136
|
async send(req, customToken) {
|
|
132
137
|
try {
|
|
133
138
|
const cancelToken = customToken || this.source.token
|
|
@@ -137,6 +142,7 @@ class Request {
|
|
|
137
142
|
return data
|
|
138
143
|
} catch (error) {
|
|
139
144
|
if (error.code) {
|
|
145
|
+
this.errorHandler && this.errorHandler(error)
|
|
140
146
|
this.store.commit('core/setGlobalError', error)
|
|
141
147
|
}
|
|
142
148
|
throw error
|