Skip to content

Commit 177aa22

Browse files
vogtnnmetulev
andauthored
email prop added to dynamicPerson, userDetails setting issue (#412)
* email prop added to dynamicPerson, removes load overwrite of data on mgt-login * updating in favor of User.mail Co-authored-by: Nikola Metulev <[email protected]>
1 parent 36ce4ca commit 177aa22

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export class MgtLogin extends MgtBaseComponent {
157157
*/
158158
protected async loadState() {
159159
const provider = Providers.globalProvider;
160-
if (provider) {
160+
if (provider && !this.userDetails) {
161161
if (provider.state === ProviderState.SignedIn) {
162162
const batch = provider.graph.forComponent(this).createBatch();
163163
batch.get('me', 'me', ['user.read']);

src/graph/graph.people.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import { Contact, Person, User } from '@microsoft/microsoft-graph-types';
99
import { IGraph } from '../IGraph';
1010
import { prepScopes } from '../utils/GraphHelpers';
11+
import { IDynamicPerson } from './types';
1112

1213
/**
1314
* Person Type enum
@@ -104,7 +105,7 @@ export async function getPeopleFromGroup(graph: IGraph, groupId: string): Promis
104105
* returns a promise that resolves after specified time
105106
* @param time in milliseconds
106107
*/
107-
export function getEmailFromGraphEntity(entity: User | Person | Contact): string {
108+
export function getEmailFromGraphEntity(entity: IDynamicPerson): string {
108109
const person = entity as Person;
109110
const user = entity as User;
110111
const contact = entity as Contact;
@@ -116,7 +117,6 @@ export function getEmailFromGraphEntity(entity: User | Person | Contact): string
116117
} else if (contact.emailAddresses && contact.emailAddresses.length) {
117118
return contact.emailAddresses[0].address;
118119
}
119-
120120
return null;
121121
}
122122

0 commit comments

Comments
 (0)