使用Pinia代替Vuex进行数据存储
This commit is contained in:
@ -68,8 +68,9 @@
|
||||
import { getCodeImg } from "@/api/login";
|
||||
import Cookies from "js-cookie";
|
||||
import { encrypt, decrypt } from "@/utils/jsencrypt";
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
const store = useStore();
|
||||
const userStore = useUserStore()
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
@ -111,7 +112,7 @@ function handleLogin() {
|
||||
Cookies.remove("rememberMe");
|
||||
}
|
||||
// 调用action的登录方法
|
||||
store.dispatch("Login", loginForm.value).then(() => {
|
||||
userStore.login(loginForm.value).then(() => {
|
||||
router.push({ path: redirect.value || "/" });
|
||||
}).catch(() => {
|
||||
loading.value = false;
|
||||
|
Reference in New Issue
Block a user