first commit

This commit is contained in:
Florinda
2024-10-18 17:42:55 +02:00
parent d99d89c135
commit ba02737680
9 changed files with 383 additions and 10 deletions

View File

@@ -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.';