From 7dea10e952987e6de423cb1971a94d4f7bb43bbf Mon Sep 17 00:00:00 2001 From: Mnickii Date: Fri, 11 Oct 2024 13:44:02 +0300 Subject: [PATCH] fire logout completed on logout --- .../mgt-components/src/components/mgt-login/mgt-login.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/mgt-components/src/components/mgt-login/mgt-login.ts b/packages/mgt-components/src/components/mgt-login/mgt-login.ts index 45f5052951..1ff6b5c078 100644 --- a/packages/mgt-components/src/components/mgt-login/mgt-login.ts +++ b/packages/mgt-components/src/components/mgt-login/mgt-login.ts @@ -243,6 +243,12 @@ export class MgtLogin extends MgtTemplatedTaskComponent { const provider = Providers.globalProvider; if (provider?.logout) { await provider.logout(); + } + }; + + private readonly completeLogout = () => { + const provider = Providers.globalProvider; + if (provider.state === ProviderState.SignedOut) { this.userDetails = null; if (provider.isMultiAccountSupportedAndEnabled) { const activeAccount = provider.getActiveAccount(); @@ -297,6 +303,9 @@ export class MgtLogin extends MgtTemplatedTaskComponent { } this.fireCustomEvent('loginCompleted'); } else { + if (provider.logout) { + this.completeLogout(); + } this.userDetails = null; } }