|
@@ -51,14 +51,14 @@ export default {
|
|
|
try {
|
|
|
const response = await userLoginPost({ username: username.value, password: password.value });
|
|
|
localStorage.setItem('token', response.token);
|
|
|
- authStore.setUser(response.user);
|
|
|
- authStore.login();
|
|
|
+ //authStore.setUser(response.user);
|
|
|
+ //authStore.login();
|
|
|
|
|
|
- if (response.user.role === 'admin') {
|
|
|
- router.push('/admin');
|
|
|
- } else {
|
|
|
- router.push('/');
|
|
|
- }
|
|
|
+// if (response.user.role === 'admin') {
|
|
|
+// router.push('/admin');
|
|
|
+// } else {
|
|
|
+// router.push('/');
|
|
|
+ router.push('/');
|
|
|
} catch (error) {
|
|
|
console.error('Login failed:', error);
|
|
|
alert('登录失败:' + (error.response?.data?.message || error.message));
|