前端:
引用signalr三方包
This commit is contained in:
@@ -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 || '登录失败')
|
||||
|
||||
Reference in New Issue
Block a user