From c92e09b3949f7c981a63237a219908799288685e Mon Sep 17 00:00:00 2001
From: MoonLeeeaf <150461955+MoonLeeeaf@users.noreply.github.com>
Date: Sun, 12 May 2024 00:14:08 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E6=97=A0=E6=B3=95=E5=9C=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ling_chair_http/index.html | 2 +-
ling_chair_http/index.js | 34 ++++++++++++++++++++--------------
2 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/ling_chair_http/index.html b/ling_chair_http/index.html
index 1f2b2d6..b5a2eed 100644
--- a/ling_chair_http/index.html
+++ b/ling_chair_http/index.html
@@ -170,7 +170,7 @@
cloud_circle
+ n-input-ls="server" onblur="" />
account_circle
diff --git a/ling_chair_http/index.js b/ling_chair_http/index.js
index 50e4ae9..928a8e4 100644
--- a/ling_chair_http/index.js
+++ b/ling_chair_http/index.js
@@ -690,18 +690,28 @@ if (!localStorage.refreshToken || localStorage.refreshToken === "")
localStorage.isSignIn = false
let client
+function setUpClient(server) {
+ if (server)
+ client = new io(server, {
+ auth: {
+ name: localStorage.isSignIn === "false" ? null : localStorage.userName
+ }
+ })
+ else
+ client = new io({
+ auth: {
+ name: localStorage.isSignIn === "false" ? null : localStorage.userName
+ }
+ })
+
+ client.on("connect", () => {
+ User.auth()
+ })
+}
if (!localStorage.server || localStorage.server === "")
- client = new io({
- auth: {
- name: localStorage.isSignIn === "false" ? null : localStorage.userName
- }
- })
+ setUpClient()
else
- client = new io(localStorage.server, {
- auth: {
- name: localStorage.isSignIn === "false" ? null : localStorage.userName
- }
- })
+ setUpClient(localStorage.server)
// 登录到账号
let dialogSignIn
@@ -727,10 +737,6 @@ else {
ContactsList.reloadList()
- client.on("connect", () => {
- User.auth()
- })
-
User.registerCallback()
}