chore: make lint happy

This commit is contained in:
CrescentLeaf
2025-10-08 00:55:09 +08:00
parent 7c7e641d1f
commit 11362a5689
6 changed files with 15 additions and 7 deletions

View File

@@ -21,6 +21,7 @@ const _data_cached = JSON.parse(_dec)
declare global {
interface Window {
data: {
refresh_token?: string
split_sizes: number[]
apply(): void
access_token?: string
@@ -29,6 +30,7 @@ declare global {
}
}
// @ts-ignore: 忽略...
// deno-lint-ignore no-window
(window.data == null) && (window.data = new Proxy({
apply() {}

View File

@@ -2,6 +2,7 @@ export type CallMethod =
"User.auth" |
"User.register" |
"User.login" |
"User.refreshAccessToken" |
"User.setAvatar" |
"User.updateProfile" |
@@ -17,6 +18,8 @@ export type CallMethod =
"Chat.getInfo" |
"Chat.createGroup" |
"Chat.getIdForPrivate" |
"Chat.getAnotherUserIdFromPrivate" |

View File

@@ -26,7 +26,7 @@ class Client {
})
this.socket!.on("connect", async () => {
this.connected = true
const re = await this.auth(data.access_token)
const re = await this.auth(data.access_token as string)
if (re.code != 200)
checkApiSuccessOrSncakbar(re, "重连失败")
})
@@ -42,7 +42,7 @@ class Client {
}
})
}
static invoke(method: CallMethod, args: unknown = {}, timeout: number = 5000, refreshAndRetryLimit: number = 3, forceRefreshAndRetry: boolean = false): Promise<ApiCallbackMessage> {
static invoke(method: CallMethod, args: object = {}, timeout: number = 5000, refreshAndRetryLimit: number = 3, forceRefreshAndRetry: boolean = false): Promise<ApiCallbackMessage> {
// 在 未初始化 / 未建立连接且调用非可调用接口 的时候进行延迟
if (this.socket == null || (!this.connected && !CallableMethodBeforeAuth.includes(method))) {
return new Promise((reslove) => {
@@ -87,7 +87,7 @@ class Client {
const re = await this.invoke("User.refreshAccessToken", {
refresh_token: data.refresh_token
})
return re.data?.access_token
return re.data?.access_token as string
}
static async auth(token: string, timeout: number = 5000) {
const re = await this.invoke("User.auth", {