@jetthai/cuora 1.1.366-dev-9 → 1.1.366-dev-10

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.1.366-dev-10](https://github.com/jetthai/cuora-module/compare/v1.1.366-dev-9...v1.1.366-dev-10) (2025-08-01)
6
+
5
7
  ### [1.1.366-dev-9](https://github.com/jetthai/cuora-module/compare/v1.1.366-dev-8...v1.1.366-dev-9) (2025-08-01)
6
8
 
7
9
  ### [1.1.366-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.366-dev-7...v1.1.366-dev-8) (2025-07-31)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.366-dev-9",
3
+ "version": "1.1.366-dev-10",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -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
 
@@ -192,6 +193,16 @@ export default class Request {
192
193
  }
193
194
 
194
195
  async send(req, customToken) {
196
+ // console.log('*查看請求的API', this.isBlocked, req)
197
+ // 終止所有的請求,除了維護頁需要的資料(siteConfig)
198
+ if (this.isBlocked && req.url !== 'getConfig') {
199
+ console.log('%c*禁止API請求', 'color: #00ff33ff; font-weight: bold;')
200
+ throw {
201
+ code: 'ERR_BLOCKED',
202
+ message: 'All API calls are blocked due to previous critical error',
203
+ url: req.url,
204
+ }
205
+ }
195
206
  try {
196
207
  const cancelToken = customToken || this.source.token
197
208
  this._checkToken(req)
@@ -199,6 +210,12 @@ export default class Request {
199
210
  const { data } = await this.axios.request(requestConfig)
200
211
  return data
201
212
  } catch (error) {
213
+ if (error.code === 'ERR_F108') {
214
+ console.log('%c*維護中', 'color: #00ff33ff; font-weight: bold;')
215
+ this.isBlocked = true
216
+ this.errorHandler && this.errorHandler(error)
217
+ throw error
218
+ }
202
219
  if (error.code !== 'ERR_800') {
203
220
  if (error.code) {
204
221
  this.errorHandler && this.errorHandler(error)