Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
djuarezgf committed Oct 18, 2024
1 parent 29387ea commit 007058b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
20 changes: 8 additions & 12 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import 'bootstrap-icons/font/bootstrap-icons.css';
import 'bootstrap';
import store from './services/store';

import {getConfig} from "@/services/configLoader"; // Import the config loader

const app = createApp(App);

Expand All @@ -26,18 +25,15 @@ const vueLifecycles = singleSpaVue({
app.use(router);
app.use(store);

export const bootstrap = () => {

export const bootstrap = async () => {
return new Promise((resolve) => {
// Load the configuration first
getConfig().then(() => {
const onAuthenticatedCallback = () => {
console.log('Authenticated!');
resolve(vueLifecycles.bootstrap);
};

// Continue with Keycloak authentication after config is loaded
KeyCloakService.CallLogin(onAuthenticatedCallback);
});
const onAuthenticatedCallback = () => {
console.log('Authenticated!');
resolve(vueLifecycles.bootstrap);
};

KeyCloakService.CallLogin(onAuthenticatedCallback);
});
};

Expand Down
11 changes: 8 additions & 3 deletions src/services/projetManagerBackendService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import KeyCloakService from "@/services/keycloak";
import {getConfig} from "@/services/configLoader";


const baseURL = (await getConfig()).VUE_APP_PROJECT_MANAGER_BACKEND_URL;

const bridgeheadParam = 'bridgehead'
const projectCodeParam = 'project-code'
Expand Down Expand Up @@ -243,8 +242,14 @@ export class ProjetManagerBackendService {
private _isInitialized: Promise<void> | undefined;

constructor(context: ProjectManagerContext, site: Site) {
this.baseURL = baseURL
this.fetchActiveModuleActions(context, site)
// Do not assign baseURL directly in the constructor
this._isInitialized = this.initialize(context, site);
}

private async initialize(context: ProjectManagerContext, site: Site): Promise<void> {
const config = await getConfig();
this.baseURL = config.VUE_APP_PROJECT_MANAGER_BACKEND_URL;
await this.fetchActiveModuleActions(context, site);
}

private fetchActiveModuleActions(context: ProjectManagerContext, site: Site) {
Expand Down

0 comments on commit 007058b

Please sign in to comment.