login projects 2
This commit is contained in:
@@ -48,7 +48,7 @@ var auth = createAuth({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
axios.defaults.baseURL = 'http://localhost:8081' //import.meta.env.VITE_BACKEND_URL;//'http://localhost:8081'
|
axios.defaults.baseURL = import.meta.env.VITE_BACKEND_URL;//'http://localhost:8081'
|
||||||
console.log(import.meta.env.VITE_BACKEND_URL);
|
console.log(import.meta.env.VITE_BACKEND_URL);
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { useLayout } from '@/layout/composables/layout';
|
|||||||
import { useAuth } from '@websanova/vue-auth/src/v3.js';
|
import { useAuth } from '@websanova/vue-auth/src/v3.js';
|
||||||
import Message from 'primevue/message';
|
import Message from 'primevue/message';
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
const auth = useAuth();
|
const auth = useAuth();
|
||||||
|
|
||||||
|
|
||||||
@@ -12,6 +13,7 @@ const username = ref('');
|
|||||||
const password = ref('');
|
const password = ref('');
|
||||||
const error = ref('');
|
const error = ref('');
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const logoUrl = computed(() => {
|
const logoUrl = computed(() => {
|
||||||
return `/layout/images/${isDarkTheme ? 'logo-white' : 'logo-dark'}.svg`;
|
return `/layout/images/${isDarkTheme ? 'logo-white' : 'logo-dark'}.svg`;
|
||||||
@@ -24,21 +26,13 @@ const login = async () => {
|
|||||||
"username":username.value,
|
"username":username.value,
|
||||||
"password":password.value
|
"password":password.value
|
||||||
},
|
},
|
||||||
//redirect:'/projects',
|
fetchUser: true
|
||||||
fetchUser: true,
|
|
||||||
//url: '/api/auth/login'
|
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
console.log("1 user :" , response.data.data);
|
console.log("1 user :" , response.data.data);
|
||||||
|
|
||||||
// Controlla se selectedProject è nullo o un oggetto vuoto
|
|
||||||
if (!response.data.data.selectedProject) {
|
if (!response.data.data.selectedProject) {
|
||||||
// Se selectedProject è nullo o vuoto, reindirizza a '/projects'
|
router.push({ name: 'projects-list' });
|
||||||
console.log("selP null" , response.data.data);
|
|
||||||
router.push({ name: 'project-list' });
|
|
||||||
} else {
|
} 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' });
|
router.push({ name: 'scenario-list' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user