@jetthai/cuora 1.1.353-dev-3 → 1.1.353-dev-5

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,10 @@
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.353-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-4...v1.1.353-dev-5) (2025-04-14)
6
+
7
+ ### [1.1.353-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-3...v1.1.353-dev-4) (2025-04-14)
8
+
5
9
  ### [1.1.353-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-2...v1.1.353-dev-3) (2025-04-11)
6
10
 
7
11
  ### [1.1.353-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-1...v1.1.353-dev-2) (2025-04-11)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.353-dev-3",
3
+ "version": "1.1.353-dev-5",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -2,8 +2,8 @@ export default {
2
2
  // 未登入排名資料
3
3
  getTournament: ({ activityNo }) => ({
4
4
  url: 'tournament/detail',
5
- method: 'get',
6
- params: { activityNo },
5
+ method: 'post',
6
+ params: { activityNo, cycle, round },
7
7
  isPublic: true,
8
8
  }),
9
9
  // 登入後排名預設期數資料
@@ -54,32 +54,47 @@ export default function (request) {
54
54
  },
55
55
  loading: {
56
56
  entry: 'setActivity',
57
- always: [{ target: 'getRankingOptions', cond: 'hasAuth' }, { target: 'getTournament' }],
57
+ always: [{ target: 'getRankingOptions' }],
58
58
  },
59
59
  setting: {
60
60
  entry: 'setOptions',
61
61
  always: [{ target: 'getRankingDetail' }],
62
62
  },
63
- // 未登入時取得排名資料
64
- getTournament: {
63
+ // 取得排名選單資料
64
+ getRankingOptions: {
65
65
  invoke: {
66
- src: 'fetchTournament',
67
- onDone: {
68
- target: 'idle',
69
- actions: 'setRanking',
70
- },
66
+ src: 'fetchRankingOptions',
67
+ onDone: [
68
+ // 有登入且為冠軍: 先拿遊戲排行榜再拿排行榜資料
69
+ {
70
+ cond: 'canGetGameRanking',
71
+ target: 'getRankingGames',
72
+ actions: 'setRankingOptions',
73
+ },
74
+ // 有登入但不為冠軍活動: 直接拿排行榜資料
75
+ {
76
+ cond: 'hasAuth',
77
+ target: 'getRankingDetail',
78
+ actions: 'setRankingOptions',
79
+ },
80
+ // 未登入; 拿未登入的排行榜資料
81
+ {
82
+ target: 'getTournament',
83
+ actions: 'setRankingOptions',
84
+ },
85
+ ],
71
86
  onError: {
72
87
  target: 'idle',
73
88
  },
74
89
  },
75
90
  },
76
- // 登入後取得排名選單資料
77
- getRankingOptions: {
91
+ // 未登入時取得排名資料
92
+ getTournament: {
78
93
  invoke: {
79
- src: 'fetchRankingOptions',
94
+ src: 'fetchTournament',
80
95
  onDone: {
81
- target: 'getRankingGames',
82
- actions: 'setRankingOptions',
96
+ target: 'idle',
97
+ actions: 'setRanking',
83
98
  },
84
99
  onError: {
85
100
  target: 'idle',
@@ -174,11 +189,12 @@ export default function (request) {
174
189
  },
175
190
  guards: {
176
191
  hasAuth: (context) => context.auth,
192
+ canGetGameRanking: (context) => context.auth && context.rule === 'CHAMPION',
177
193
  },
178
194
  services: {
179
195
  fetchTournament: async (context) => {
180
- const { activityNo } = context
181
- const { data } = await request.send(ranking.getTournament({ activityNo }))
196
+ const { activityNo, cycle, round } = context
197
+ const { data } = await request.send(ranking.getTournament({ activityNo, cycle, round }))
182
198
  return data
183
199
  },
184
200
  fetchRankingOptions: async (context) => {