@jetthai/cuora 1.1.406 → 1.1.407
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/machine/auth.js +1 -4
- package/src/request/request.js +3 -13
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.407](https://github.com/jetthai/cuora-module/compare/v1.1.406...v1.1.407) (2025-12-22)
|
|
6
|
+
|
|
5
7
|
### [1.1.406](https://github.com/jetthai/cuora-module/compare/v1.1.405...v1.1.406) (2025-12-16)
|
|
6
8
|
|
|
7
9
|
### [1.1.405](https://github.com/jetthai/cuora-module/compare/v1.1.404...v1.1.405) (2025-12-16)
|
package/package.json
CHANGED
package/src/machine/auth.js
CHANGED
|
@@ -465,10 +465,7 @@ export default function (request) {
|
|
|
465
465
|
referralObj.channel = storage.get('channel') || defaultChannel || channel
|
|
466
466
|
referralObj.subchannel = storage.get('subchannel') || defaultSubchannel || subchannel
|
|
467
467
|
|
|
468
|
-
|
|
469
|
-
// 但 ZALO 仍維持 v1
|
|
470
|
-
const fullURL =
|
|
471
|
-
['OZE', 'ZAZA'].includes(clientId) && provider !== 'zalo' ? request.config.fullURL.replace('/v1/', '/v2/') : request.config.fullURL
|
|
468
|
+
const fullURL = request.config.fullURL
|
|
472
469
|
|
|
473
470
|
const redirectURL = urljoin(
|
|
474
471
|
fullURL,
|
package/src/request/request.js
CHANGED
|
@@ -241,13 +241,10 @@ export default class Request {
|
|
|
241
241
|
this._checkToken(req)
|
|
242
242
|
|
|
243
243
|
const requestConfig = this._createConfig(req, cancelToken)
|
|
244
|
-
// console.log('*請求資料Check', requestConfig)
|
|
245
244
|
const configUrls = ['getConfig', 'get-config']
|
|
246
245
|
if (this.isBlocked && !configUrls.includes(requestConfig.url)) {
|
|
247
246
|
// 狀態是維護中&請求非siteConfig,終止所有的請求,除了維護頁需要的資料(siteConfig)
|
|
248
|
-
// console.log('%c*禁止的請求目標', requestConfig)
|
|
249
247
|
} else {
|
|
250
|
-
// console.log('%c*允許的請求目標', requestConfig)
|
|
251
248
|
const { data } = await this.axios.request(requestConfig)
|
|
252
249
|
return data
|
|
253
250
|
}
|
|
@@ -280,9 +277,9 @@ export default class Request {
|
|
|
280
277
|
const { method, url, params, isPublic, isFormData, headers } = req
|
|
281
278
|
let fullURL = this.config.fullURL
|
|
282
279
|
let urlName = url
|
|
280
|
+
|
|
283
281
|
// 有些API會將參數(/?)直接帶在URL上,所以要將參數排除
|
|
284
282
|
const cleanUrl = url.split('?')[0]
|
|
285
|
-
|
|
286
283
|
const isV2Supported = supportVersion2List.some((supportedUrl) => {
|
|
287
284
|
// 如果包含動態參數(:parameter),則使用模式匹配
|
|
288
285
|
if (supportedUrl.includes(':')) {
|
|
@@ -292,16 +289,9 @@ export default class Request {
|
|
|
292
289
|
}
|
|
293
290
|
return supportedUrl === cleanUrl
|
|
294
291
|
})
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
const supportV2Toggle = [''].includes(this.config?.clientId)
|
|
298
|
-
|
|
299
|
-
if (isV2Supported && !supportV2Toggle) {
|
|
300
|
-
fullURL = fullURL.replace('/v1/', '/v2/')
|
|
292
|
+
// 符合轉換規則的API進行路徑調整
|
|
293
|
+
if (isV2Supported) {
|
|
301
294
|
urlName = this._convertUrlToKebabCase(url)
|
|
302
|
-
// console.log(`*[DEV_ONLY]V2`, 'url:', urlName)
|
|
303
|
-
} else {
|
|
304
|
-
// console.log(`*[DEV_ONLY]V2-不支援:`, 'url:', urlName)
|
|
305
295
|
}
|
|
306
296
|
|
|
307
297
|
if (isFormData) {
|