@jetthai/cuora 1.1.373-qa-2 → 1.1.373-qa-3
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/request/request.js +18 -2
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.1.373-qa-3](https://github.com/jetthai/cuora-module/compare/v1.1.373-qa-2...v1.1.373-qa-3) (2025-08-26)
|
|
6
|
+
|
|
5
7
|
### [1.1.373-qa-2](https://github.com/jetthai/cuora-module/compare/v1.1.373-qa-1...v1.1.373-qa-2) (2025-08-25)
|
|
6
8
|
|
|
7
9
|
### [1.1.373-qa-1](https://github.com/jetthai/cuora-module/compare/v1.1.373...v1.1.373-qa-1) (2025-08-22)
|
package/package.json
CHANGED
package/src/request/request.js
CHANGED
|
@@ -149,6 +149,7 @@ export default class Request {
|
|
|
149
149
|
this.key = `cuora_${config.clientId}`
|
|
150
150
|
this.errorHandler = null
|
|
151
151
|
this.hosts = []
|
|
152
|
+
this.isBlocked = false
|
|
152
153
|
this.initialize()
|
|
153
154
|
}
|
|
154
155
|
|
|
@@ -195,10 +196,25 @@ export default class Request {
|
|
|
195
196
|
try {
|
|
196
197
|
const cancelToken = customToken || this.source.token
|
|
197
198
|
this._checkToken(req)
|
|
199
|
+
|
|
198
200
|
const requestConfig = this._createConfig(req, cancelToken)
|
|
199
|
-
|
|
200
|
-
|
|
201
|
+
// console.log('*請求資料Check', requestConfig)
|
|
202
|
+
const configUrls = ['getConfig', 'get-config']
|
|
203
|
+
if (this.isBlocked && !configUrls.includes(requestConfig.url)) {
|
|
204
|
+
// 狀態是維護中&請求非siteConfig,終止所有的請求,除了維護頁需要的資料(siteConfig)
|
|
205
|
+
// console.log('%c*禁止的請求目標', requestConfig)
|
|
206
|
+
} else {
|
|
207
|
+
// console.log('%c*允許的請求目標', requestConfig)
|
|
208
|
+
const { data } = await this.axios.request(requestConfig)
|
|
209
|
+
return data
|
|
210
|
+
}
|
|
201
211
|
} catch (error) {
|
|
212
|
+
if (error.code === 'ERR_F108') {
|
|
213
|
+
console.log('%c*維護中', 'color: #00ff33ff; font-weight: bold;')
|
|
214
|
+
this.isBlocked = true
|
|
215
|
+
this.errorHandler && this.errorHandler(error)
|
|
216
|
+
throw error
|
|
217
|
+
}
|
|
202
218
|
if (error.code !== 'ERR_800') {
|
|
203
219
|
if (error.code) {
|
|
204
220
|
this.errorHandler && this.errorHandler(error)
|