From 65bb0763842430a2f2460b01429e4f3aa9223c32 Mon Sep 17 00:00:00 2001 From: xRain Date: Mon, 4 May 2026 23:28:35 +0800 Subject: [PATCH] =?UTF-8?q?checklogin=E7=8E=B0=E5=9C=A8=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/simapi.core.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/simapi.core.ts b/src/simapi.core.ts index 5572fa0..fd6d1e7 100644 --- a/src/simapi.core.ts +++ b/src/simapi.core.ts @@ -80,7 +80,7 @@ export class SimApiCore { private debug: boolean = true private auth: SimApiAuthConfig = { token_name: 'simapi-auth-token', - check_url: '/auth/check', + check_url: '/user/info', logout_url: '/auth/logout', login_url: '/auth/login', } @@ -129,7 +129,7 @@ export class SimApiCore { this.debug = config.debug } if (config.endpoints) { - this.api.endpoints = { ...this.api.endpoints, ...config.endpoints } + this.api.endpoints = {...this.api.endpoints, ...config.endpoints} } if (config.defaultEndpoint) { this.api.defaultEndpoint = config.defaultEndpoint @@ -340,12 +340,7 @@ export class SimApiCore { return true } - async checkLogin(url?: string | null): Promise { - if (url !== null) { - await this.query(url ?? this.auth.check_url).catch(() => { - }) - } else if (this.getToken()) { - this.api.businessCallback[401]?.(null) - } + async checkLogin(url?: string | null): Promise { + return this.query(url ?? this.auth.check_url); } }