Skip to content

Commit e0ee430

Browse files
Fix for this issue (#612)
1 parent 925fb85 commit e0ee430

File tree

4 files changed

+58
-1
lines changed

4 files changed

+58
-1
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
"semibold",
1111
"xmlns"
1212
],
13-
"tslint.configFile": "./config/tslint.json"
13+
"tslint.configFile": "./config/tslint.json"
1414
}

packages/mgt/src/components/mgt-login/mgt-login.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ export class MgtLogin extends MgtTemplatedComponent {
178178
if (this.userDetails.personImage) {
179179
this._image = this.userDetails.personImage;
180180
}
181+
182+
this.fireCustomEvent('loginCompleted');
181183
} else {
182184
this.userDetails = null;
183185
}

samples/examples/login-popup.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<script type="module" src="../../packages/mgt/dist/es6/index.js"></script>
6+
</head>
7+
8+
<body>
9+
<!-- <mgt-msal-provider client-id="af4ad92c-e141-49ac-9d86-23af45007101"></mgt-msal-provider> -->
10+
11+
<mgt-login></mgt-login>
12+
13+
<div id="loginStatus" style="padding-top: 20px">
14+
</div>
15+
16+
<script type="module">
17+
import { Providers, ProviderState, MsalProvider, LoginType } from '../../packages/mgt/dist/es6/index.js';
18+
19+
Providers.globalProvider = new MsalProvider({
20+
clientId: 'af4ad92c-e141-49ac-9d86-23af45007101',
21+
loginType: LoginType.Popup
22+
});
23+
24+
document.querySelector('mgt-login').addEventListener('loginCompleted', e => {
25+
console.log(e);
26+
document.getElementById('loginStatus').innerText = "Login completed successfully";
27+
});
28+
</script>
29+
30+
</html>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<script type="module" src="../../packages/mgt/dist/es6/index.js"></script>
6+
</head>
7+
8+
<body>
9+
<mgt-msal-provider client-id="af4ad92c-e141-49ac-9d86-23af45007101"></mgt-msal-provider>
10+
11+
<mgt-login></mgt-login>
12+
13+
<div id="loginStatus" style="padding-top: 20px">
14+
</div>
15+
16+
<script type="module">
17+
import { Providers, ProviderState } from '../../packages/mgt/dist/es6/index.js';
18+
19+
document.querySelector('mgt-login').addEventListener('loginCompleted', e => {
20+
console.log(e);
21+
document.getElementById('loginStatus').innerText = "Login completed successfully";
22+
});
23+
</script>
24+
25+
</html>

0 commit comments

Comments
 (0)