first commit
This commit is contained in:
@@ -24,10 +24,28 @@ const login = async () => {
|
||||
"username":username.value,
|
||||
"password":password.value
|
||||
},
|
||||
redirect:'/',
|
||||
//redirect:'/projects',
|
||||
fetchUser: true,
|
||||
//url: '/api/auth/login'
|
||||
})
|
||||
}).then((response) => {
|
||||
console.log("1 user :" , response.data.data);
|
||||
|
||||
// Controlla se selectedProject è nullo o un oggetto vuoto
|
||||
if (!response.data.data.selectedProject) {
|
||||
// Se selectedProject è nullo o vuoto, reindirizza a '/projects'
|
||||
console.log("selP null" , response.data.data);
|
||||
router.push({ name: 'project-list' });
|
||||
} else {
|
||||
// Se selectedProject è nullo o vuoto, reindirizza a '/projects'
|
||||
console.log("selP not null" , response.data.data);
|
||||
// Altrimenti, reindirizza a '/scenarios'
|
||||
router.push({ name: 'scenario-list' });
|
||||
}
|
||||
|
||||
console.log("response", response);
|
||||
}).catch((error) => {
|
||||
console.log("error", error);
|
||||
});
|
||||
} catch (err) {
|
||||
console.log( 'Error ' + err)
|
||||
error.value = 'Incorrect username or password. Please try again.';
|
||||
|
||||
Reference in New Issue
Block a user