Skip to content
This repository was archived by the owner on Aug 3, 2025. It is now read-only.

Commit 6636f93

Browse files
committed
fix: hack to fix login
1 parent 07a9914 commit 6636f93

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

admin-api-frontend/src/index.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom/client';
33
import { BrowserRouter } from 'react-router-dom';
44
import { PublicClientApplication, EventType } from '@azure/msal-browser';
55

6-
import { msalConfig } from './authConfig.js';
6+
import { msalConfig, loginRequest } from './authConfig.js';
77
import App from './App';
88

99
import 'bootstrap/dist/css/bootstrap.min.css';
@@ -33,8 +33,19 @@ msalInstance.addEventCallback((event) => {
3333

3434
const root = ReactDOM.createRoot(document.getElementById('root'));
3535

36-
root.render(
37-
<BrowserRouter>
38-
<App instance={msalInstance} />
39-
</BrowserRouter>
40-
);
36+
if (!msalInstance.getActiveAccount()) {
37+
await msalInstance.initialize();
38+
msalInstance.loginPopup(loginRequest).then(response => {
39+
root.render(
40+
<BrowserRouter>
41+
<App instance={msalInstance} />
42+
</BrowserRouter>
43+
);
44+
});
45+
} else {
46+
root.render(
47+
<BrowserRouter>
48+
<App instance={msalInstance} />
49+
</BrowserRouter>
50+
);
51+
}

0 commit comments

Comments
 (0)