From 6636f9350317b8d23dc5430a7c87516449160c53 Mon Sep 17 00:00:00 2001 From: kaushik327 Date: Mon, 1 Apr 2024 13:31:58 -0500 Subject: [PATCH] fix: hack to fix login --- admin-api-frontend/src/index.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/admin-api-frontend/src/index.js b/admin-api-frontend/src/index.js index 5462c16..d47a259 100644 --- a/admin-api-frontend/src/index.js +++ b/admin-api-frontend/src/index.js @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom/client'; import { BrowserRouter } from 'react-router-dom'; import { PublicClientApplication, EventType } from '@azure/msal-browser'; -import { msalConfig } from './authConfig.js'; +import { msalConfig, loginRequest } from './authConfig.js'; import App from './App'; import 'bootstrap/dist/css/bootstrap.min.css'; @@ -33,8 +33,19 @@ msalInstance.addEventCallback((event) => { const root = ReactDOM.createRoot(document.getElementById('root')); -root.render( - - - -); \ No newline at end of file +if (!msalInstance.getActiveAccount()) { + await msalInstance.initialize(); + msalInstance.loginPopup(loginRequest).then(response => { + root.render( + + + + ); + }); +} else { + root.render( + + + + ); +} \ No newline at end of file