Refactor AppMenu and AppTopbar components

- Updated the AppMenu component to only add available scenarios to the menu if there are any.
- Refactored the AppTopbar component to use the selectedApp value from the UserPrefStore.
- Added an updateApplication function to update the selectedApp value in the UserPrefStore and fetch the application scenarios.
- Created a watcher to update the selectedApp value when it changes in the UserPrefStore.

Fix axios base URL configuration

- Updated the axios base URL configuration in the main.js file to use a hardcoded URL instead of the VITE_BACKEND_URL environment variable.

Update ProjectService and UserPrefStore

- Added an updateSelectedApplication function to the ProjectService to update the selected application.
- Updated the UserPrefStore to fetch the selected application from the user data and set it as the selectedApp value.
- Added a setSelectedApp function to the UserPrefStore to update the selectedApp value and call the updateSelectedApplication function.

Update ScenarioStore

- Updated the fetchApplicationScenarios function in the ScenarioStore to use the selectedApp value from the UserPrefStore when fetching scenarios.

Remove unused components

- Removed the Empty, SeatDemo, PersonalDemo, PaymentDemo, ConfirmationDemo, TreeDoc, and FileDoc components from the project.

Fix menu typo

- Fixed a typo in the menu component.

Revert changes for Canva

- Reverted the changes made for Canva.

Merge branch 'master' of https://gitlab.gcp.windtre.it/olympus_ai/hermione-fe

- Merged the changes from the master branch of the remote repository.
This commit is contained in:
andrea.terzani
2024-10-25 19:41:24 +02:00
parent e44edba795
commit d7882baeab
6 changed files with 36 additions and 15 deletions

View File

@@ -18,6 +18,7 @@ export const UserPrefStore = defineStore('userpref_store', () => {
loadingStore.user_loading = true;
await auth.fetch().then((fetchedUser) => {
user.value = fetchedUser.data.data;
selectedApp.value = user.value.selectedApplication;
userLoaded.value = true;
loadingStore.user_loading = false;
}).catch((error) => {
@@ -29,11 +30,8 @@ export const UserPrefStore = defineStore('userpref_store', () => {
try {
loadingStore.user_loading = true;
selectedApp.value = null;
// Aspetta che l'aggiornamento del progetto finisca
await ProjectService.updateSelectedProject(project);
} catch (error) {
console.error("Errore durante l'aggiornamento del progetto:", error);
@@ -46,8 +44,11 @@ export const UserPrefStore = defineStore('userpref_store', () => {
function setSelectedApp(app){
async function setSelectedApp(app){
loadingStore.user_loading = true;
await ProjectService.updateSelectedApplication(app);
selectedApp.value = app;
loadingStore.user_loading = false;
}
const selectedProject = computed(() => user.value.selectedProject)