前端:

引用signalr三方包
This commit is contained in:
2026-01-19 19:37:47 +08:00
parent e7dbb651a2
commit 507788f6a3
9 changed files with 274 additions and 9 deletions
+3
View File
@@ -57,10 +57,12 @@ import MyButton from '@/components/MyButton.vue'
import { required, maxLength, helpers } from '@vuelidate/validators'
import useVuelidate from '@vuelidate/core'
import { useAuthStore } from '@/stores/auth'
import { useSignalRStore } from '@/stores/signalr'
const message = useMessage();
const router = useRouter();
const authStore = useAuthStore();
const signalRStore = useSignalRStore();
const loading = ref(false)
const form = reactive({
@@ -96,6 +98,7 @@ const handleLogin = async () => {
if(res.code === 0){ // Assuming 0 is success
message.success('登录成功')
authStore.setLoginInfo(res.data.token, res.data.refreshToken, res.data.userInfo);
signalRStore.initSignalR(res.data.token);
router.push('/messages')
}else{
message.error(res.message || '登录失败')