feat: 刷新 Access Token(带并发锁)

This commit is contained in:
2026-06-30 09:03:26 +08:00
parent dd97f9cb70
commit b85c3cbd60
4 changed files with 19 additions and 12 deletions

View File

@@ -1,4 +1,5 @@
import { fetchEventSource } from '@microsoft/fetch-event-source'
import { ElMessage } from 'element-plus'
/**
* SSE 连接客户端
@@ -89,6 +90,7 @@ export class SseClient {
return
}
this.callbacks.onMessage(message.event, message.data)
ElMessage.success(message.event)
},
onclose: () => {

View File

@@ -1,6 +1,9 @@
import mitt from 'mitt'
import type { RoomItem } from '@/api/modules/game'
/**
* SSE 事件定义
*/
export type SseEvents = {
connected: undefined
error: { message: string; retryCount: number }
@@ -10,6 +13,8 @@ export type SseEvents = {
kicked: { roomId: string }
game_started: { roomId: string }
balance_chg: { balance: number; delta: number }
/** 自定义事件类型,用于测试或任意消息推送,数据格式由调用方决定 */
custom: unknown
}
/**