Skip to content

Commit 86df362

Browse files
committed
Snippet fixes
1 parent 83cdafb commit 86df362

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

demo/graph-tutorial/src/app/auth.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ export class AuthService {
1717
public authenticated: boolean;
1818
public user: User;
1919

20-
// <constructor>
20+
// <constructorSnippet>
2121
constructor(
2222
private msalService: MsalService,
2323
private alertsService: AlertsService) {
2424

2525
this.authenticated = this.msalService.getAccount() != null;
2626
this.getUser().then((user) => {this.user = user});
2727
}
28-
// </constructor>
28+
// </constructorSnippet>
2929

3030
// Prompt the user to sign in and
3131
// grant consent to the requested permission scopes
@@ -61,7 +61,7 @@ export class AuthService {
6161
return null;
6262
}
6363

64-
// <getUser>
64+
// <getUserSnippet>
6565
private async getUser(): Promise<User> {
6666
if (!this.authenticated) return null;
6767

@@ -94,5 +94,5 @@ export class AuthService {
9494

9595
return user;
9696
}
97-
// </getUser>
97+
// </getUserSnippet>
9898
}

demo/graph-tutorial/src/app/calendar/calendar.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ export class CalendarComponent implements OnInit {
2121
private graphService: GraphService,
2222
private alertsService: AlertsService) { }
2323

24-
// <ngOnInit>
24+
// <ngOnInitSnippet>
2525
ngOnInit() {
2626
this.graphService.getEvents()
2727
.then((events) => {
2828
this.events = events;
2929
});
3030
}
31-
// </ngOnInit>
31+
// </ngOnInitSnippet>
3232

33-
// <formatDateTimeTimeZone>
33+
// <formatDateTimeTimeZoneSnippet>
3434
formatDateTimeTimeZone(dateTime: DateTimeTimeZone): string {
3535
try {
3636
return moment.tz(dateTime.dateTime, dateTime.timeZone).format();
@@ -39,5 +39,5 @@ export class CalendarComponent implements OnInit {
3939
this.alertsService.add('DateTimeTimeZone conversion error', JSON.stringify(error));
4040
}
4141
}
42-
// </formatDateTimeTimeZone>
42+
// </formatDateTimeTimeZoneSnippet>
4343
}

demo/graph-tutorial/src/app/graph.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
// <graphService>
4+
// <graphServiceSnippet>
55
import { Injectable } from '@angular/core';
66
import { Client } from '@microsoft/microsoft-graph-client';
77

@@ -52,4 +52,4 @@ export class GraphService {
5252
}
5353
}
5454
}
55-
// </graphService>
55+
// </graphServiceSnippet>

demo/graph-tutorial/src/app/home/home.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ export class HomeComponent implements OnInit {
2525

2626
ngOnInit() {}
2727

28-
// <signIn>
28+
// <signInSnippet>
2929
async signIn(): Promise<void> {
3030
await this.authService.signIn();
3131
}
32-
// </signIn>
32+
// </signInSnippet>
3333
}

tutorial/04-add-aad-auth.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Right now the authentication service sets constant values for the user's display
123123

124124
1. Add a new function to the `AuthService` class called `getUser`.
125125

126-
:::code language="typescript" source="../demo/graph-tutorial/src/app/auth.service.ts" id="getUser":::
126+
:::code language="typescript" source="../demo/graph-tutorial/src/app/auth.service.ts" id="getUserSnippet":::
127127

128128
1. Locate and remove the following code in the `getAccessToken` method that adds an alert to display the access token.
129129

@@ -151,11 +151,11 @@ Right now the authentication service sets constant values for the user's display
151151

152152
1. Change the `constructor` for the `AuthService` class to check if the user is already logged in and load their details if so. Replace the existing `constructor` with the following.
153153

154-
:::code language="typescript" source="../demo/graph-tutorial/src/app/auth.service.ts" id="constructor" highlight="5-6":::
154+
:::code language="typescript" source="../demo/graph-tutorial/src/app/auth.service.ts" id="constructorSnippet" highlight="5-6":::
155155

156156
1. Remove the temporary code from the `HomeComponent` class. Open the `./src/app/home/home.component.ts` file and replace the existing `signIn` function with the following.
157157

158-
:::code language="typescript" source="../demo/graph-tutorial/src/app/home/home.component.ts" id="signIn" highlight="5-6":::
158+
:::code language="typescript" source="../demo/graph-tutorial/src/app/home/home.component.ts" id="signInSnippet" highlight="5-6":::
159159

160160
Now if you save your changes and start the app, after sign-in you should end up back on the home page, but the UI should change to indicate that you are signed-in.
161161

tutorial/05-add-ms-graph.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ In this exercise you will incorporate the Microsoft Graph into the application.
1818

1919
1. Once the command completes, open the `./src/app/graph.service.ts` file and replace its contents with the following.
2020

21-
:::code language="typescript" source="../demo/graph-tutorial/src/app/graph.service.ts" id="graphService":::
21+
:::code language="typescript" source="../demo/graph-tutorial/src/app/graph.service.ts" id="graphServiceSnippet":::
2222

2323
Consider what this code is doing.
2424

@@ -87,11 +87,11 @@ Now you can update the `CalendarComponent` component to display the events in a
8787
8888
1. Remove the temporary code that adds an alert from the `ngOnInit` function. Your updated function should look like this.
8989
90-
:::code language="typescript" source="../demo/graph-tutorial/src/app/calendar/calendar.component.ts" id="ngOnInit":::
90+
:::code language="typescript" source="../demo/graph-tutorial/src/app/calendar/calendar.component.ts" id="ngOnInitSnippet":::
9191
9292
1. Add a function to the `CalendarComponent` class to format a `DateTimeTimeZone` object into an ISO string.
9393
94-
:::code language="typescript" source="../demo/graph-tutorial/src/app/calendar/calendar.component.ts" id="formatDateTimeTimeZone":::
94+
:::code language="typescript" source="../demo/graph-tutorial/src/app/calendar/calendar.component.ts" id="formatDateTimeTimeZoneSnippet":::
9595
9696
1. Open the `./src/app/calendar/calendar.component.html` file and replace its contents with the following.
9797

0 commit comments

Comments
 (0)