From e2edc883103c50a99b5acfc8d2f7d8f44028adf3 Mon Sep 17 00:00:00 2001 From: Nickii Miaro Date: Thu, 17 Oct 2024 11:53:08 +0300 Subject: [PATCH] fix: fire logout completed on logout (#3332) --- .../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; } }