@jetthai/cuora 1.1.270-jackpot-2 → 1.1.272-jackpot-1

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,9 +2,11 @@
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.270-jackpot-2](https://github.com/jetthai/cuora-module/compare/v1.1.270-jackpot-1...v1.1.270-jackpot-2) (2024-05-17)
5
+ ### [1.1.272-jackpot-1](https://github.com/jetthai/cuora-module/compare/v1.1.272...v1.1.272-jackpot-1) (2024-05-23)
6
6
 
7
- ### [1.1.270-jackpot-1](https://github.com/jetthai/cuora-module/compare/v1.1.270...v1.1.270-jackpot-1) (2024-05-16)
7
+ ### [1.1.272](https://github.com/jetthai/cuora-module/compare/v1.1.270...v1.1.272) (2024-05-21)
8
+
9
+ ### [1.1.271](https://github.com/jetthai/cuora-module/compare/v1.1.270...v1.1.271) (2024-05-21)
8
10
 
9
11
  ### [1.1.270](https://github.com/jetthai/cuora-module/compare/v1.1.269...v1.1.270) (2024-05-16)
10
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.270-jackpot-2",
3
+ "version": "1.1.272-jackpot-1",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
package/src/api/user.js CHANGED
@@ -57,4 +57,6 @@ export default {
57
57
  isPublic: true,
58
58
  }),
59
59
  otpReset: ({ requestId, target }) => ({ url: '/otpsso/reset', method: 'post', params: { requestId, target }, isPublic: true }),
60
+ getUserPhotoList: () => ({ url: 'getAllAvatar', method: 'get' }),
61
+ updateUserPhoto: (data) => ({ url: 'updateUserAvatar', method: 'post', params: data }),
60
62
  }
@@ -136,6 +136,29 @@ export default function (request) {
136
136
  EXIT_GAME: {
137
137
  target: 'disconnect',
138
138
  },
139
+ REFRESH: {
140
+ target: 'refreshing',
141
+ },
142
+ },
143
+ },
144
+ refreshing: {
145
+ invoke: {
146
+ src: 'disconnectGame',
147
+ onDone: {
148
+ target: 'refreshPending',
149
+ actions: 'setGameURL',
150
+ },
151
+ onError: {
152
+ target: 'idle',
153
+ actions: 'setGameURL',
154
+ },
155
+ },
156
+ },
157
+ refreshPending: {
158
+ after: {
159
+ 500: {
160
+ target: 'connecting',
161
+ },
139
162
  },
140
163
  },
141
164
  disconnect: {
@@ -33,6 +33,7 @@ import vip_table from './vip_table.js'
33
33
  import promotions from './promotions.js'
34
34
  import roulette_v2 from './roulette_v2.js'
35
35
  import honor_board_cash from './honor_board_cash.js'
36
+ import user_photo from './user_photo.js'
36
37
 
37
38
  export default {
38
39
  ...activity,
@@ -69,5 +70,6 @@ export default {
69
70
  promotions,
70
71
  roulette_v2,
71
72
  honor_board_cash,
73
+ user_photo,
72
74
  ...withdraw,
73
75
  }
@@ -0,0 +1,67 @@
1
+ import { assign, createMachine } from 'xstate'
2
+ import user from '../api/user.js'
3
+
4
+ export default function (request) {
5
+ return createMachine(
6
+ {
7
+ id: 'user_photo',
8
+ initial: 'fetching',
9
+ context: {
10
+ userPhotoList: {},
11
+ },
12
+ states: {
13
+ fetching: {
14
+ invoke: {
15
+ src: 'fetchUserPhotoList',
16
+ onDone: {
17
+ target: 'idle',
18
+ actions: 'setUserPhotoList',
19
+ },
20
+ onError: {
21
+ target: 'idle',
22
+ },
23
+ },
24
+ },
25
+ idle: {
26
+ on: {
27
+ UPDATE_USER_PHOTO: {
28
+ target: 'updating',
29
+ },
30
+ },
31
+ },
32
+ updating: {
33
+ invoke: {
34
+ src: 'updateUserPhoto',
35
+ onDone: {
36
+ target: 'idle',
37
+ },
38
+ onError: {
39
+ target: 'idle',
40
+ },
41
+ },
42
+ },
43
+ },
44
+ },
45
+ {
46
+ actions: {
47
+ setUserPhotoList: assign((context, event) => {
48
+ return {
49
+ userPhotoList: event.data.data,
50
+ }
51
+ }),
52
+ },
53
+ services: {
54
+ // 取得使用者頭像列表
55
+ fetchUserPhotoList: async (context, event) => {
56
+ console.log('?fetchUserPhotoList')
57
+ return await request.send(user.getUserPhotoList())
58
+ },
59
+ // 更新使用者頭像
60
+ updateUserPhoto: async (context, event) => {
61
+ console.log('?updateUserPhoto', event.data)
62
+ return await request.send(user.updateUserPhoto(event.data))
63
+ },
64
+ },
65
+ }
66
+ )
67
+ }