Skip to content

Commit dd34623

Browse files
committed
Updated dependencies
Also fixed issue reported in #41
1 parent a11bfb5 commit dd34623

File tree

12 files changed

+3129
-3401
lines changed

12 files changed

+3129
-3401
lines changed

demo/graph-tutorial/package-lock.json

Lines changed: 2139 additions & 2451 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/graph-tutorial/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@fortawesome/fontawesome-free": "^5.12.1",
6+
"@fortawesome/fontawesome-free": "^5.13.1",
77
"@microsoft/microsoft-graph-client": "^2.0.0",
88
"@testing-library/jest-dom": "^4.2.4",
99
"@testing-library/react": "^9.3.2",
1010
"@testing-library/user-event": "^7.1.2",
1111
"@types/jest": "^24.0.0",
12-
"@types/microsoft-graph": "^1.12.0",
12+
"@types/microsoft-graph": "^1.13.0",
1313
"@types/node": "^12.0.0",
1414
"@types/react": "^16.9.0",
1515
"@types/react-dom": "^16.9.0",
16-
"@types/react-router-dom": "^5.1.3",
17-
"@types/reactstrap": "^8.4.2",
18-
"bootstrap": "^4.4.1",
19-
"moment": "^2.24.0",
20-
"msal": "^1.2.1",
21-
"react": "^16.13.0",
22-
"react-dom": "^16.13.0",
23-
"react-router-dom": "^5.1.2",
24-
"react-scripts": "3.4.0",
25-
"reactstrap": "^8.4.1",
16+
"@types/react-router-dom": "^5.1.5",
17+
"@types/reactstrap": "^8.5.0",
18+
"bootstrap": "^4.5.0",
19+
"moment": "^2.27.0",
20+
"msal": "^1.3.2",
21+
"react": "^16.13.1",
22+
"react-dom": "^16.13.1",
23+
"react-router-dom": "^5.2.0",
24+
"react-scripts": "3.4.1",
25+
"reactstrap": "^8.5.1",
2626
"typescript": "~3.7.2"
2727
},
2828
"scripts": {

demo/graph-tutorial/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class App extends Component<AuthComponentProps> {
2626
<NavBar
2727
isAuthenticated={this.props.isAuthenticated}
2828
authButtonMethod={this.props.isAuthenticated ? this.props.logout : this.props.login}
29-
user={this.props.user}/>
29+
user={this.props.user} />
3030
<Container>
3131
{error}
3232
<Route exact path="/"

demo/graph-tutorial/src/AuthProvider.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ interface AuthProviderState {
2323
}
2424

2525
export default function withAuthProvider<T extends React.Component<AuthComponentProps>>
26-
(WrappedComponent: new(props: AuthComponentProps, context?: any) => T): React.ComponentClass {
26+
(WrappedComponent: new (props: AuthComponentProps, context?: any) => T): React.ComponentClass {
2727
return class extends React.Component<any, AuthProviderState> {
2828
private userAgentApplication: UserAgentApplication;
2929

@@ -38,12 +38,12 @@ export default function withAuthProvider<T extends React.Component<AuthComponent
3838
// Initialize the MSAL application object
3939
this.userAgentApplication = new UserAgentApplication({
4040
auth: {
41-
clientId: config.appId,
42-
redirectUri: config.redirectUri
41+
clientId: config.appId,
42+
redirectUri: config.redirectUri
4343
},
4444
cache: {
45-
cacheLocation: "sessionStorage",
46-
storeAuthStateInCookie: true
45+
cacheLocation: "sessionStorage",
46+
storeAuthStateInCookie: true
4747
}
4848
});
4949
}
@@ -61,28 +61,28 @@ export default function withAuthProvider<T extends React.Component<AuthComponent
6161

6262
render() {
6363
return <WrappedComponent
64-
error = { this.state.error }
65-
isAuthenticated = { this.state.isAuthenticated }
66-
user = { this.state.user }
67-
login = { () => this.login() }
68-
logout = { () => this.logout() }
69-
getAccessToken = { (scopes: string[]) => this.getAccessToken(scopes)}
70-
setError = { (message: string, debug: string) => this.setErrorMessage(message, debug)}
71-
{...this.props} {...this.state} />;
64+
error={this.state.error}
65+
isAuthenticated={this.state.isAuthenticated}
66+
user={this.state.user}
67+
login={() => this.login()}
68+
logout={() => this.logout()}
69+
getAccessToken={(scopes: string[]) => this.getAccessToken(scopes)}
70+
setError={(message: string, debug: string) => this.setErrorMessage(message, debug)}
71+
{...this.props} />;
7272
}
7373

7474
async login() {
7575
try {
7676
// Login via popup
7777
await this.userAgentApplication.loginPopup(
78-
{
79-
scopes: config.scopes,
80-
prompt: "select_account"
78+
{
79+
scopes: config.scopes,
80+
prompt: "select_account"
8181
});
8282
// After login, get the user's profile
8383
await this.getUserProfile();
8484
}
85-
catch(err) {
85+
catch (err) {
8686
this.setState({
8787
isAuthenticated: false,
8888
user: {},
@@ -151,13 +151,13 @@ export default function withAuthProvider<T extends React.Component<AuthComponent
151151

152152
setErrorMessage(message: string, debug: string) {
153153
this.setState({
154-
error: {message: message, debug: debug}
154+
error: { message: message, debug: debug }
155155
});
156156
}
157157

158158
normalizeError(error: string | Error): any {
159159
var normalizedError = {};
160-
if (typeof(error) === 'string') {
160+
if (typeof (error) === 'string') {
161161
var errParts = error.split('|');
162162
normalizedError = errParts.length > 1 ?
163163
{ message: errParts[1], debug: errParts[0] } :

demo/graph-tutorial/src/Calendar.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
13
import React from 'react';
24
import { Table } from 'reactstrap';
35
import moment from 'moment';
@@ -33,9 +35,9 @@ class Calendar extends React.Component<AuthComponentProps, CalendarState> {
3335
// Get the user's events
3436
var events = await getEvents(accessToken);
3537
// Update the array of events in state
36-
this.setState({events: events.value});
38+
this.setState({ events: events.value });
3739
}
38-
catch(err) {
40+
catch (err) {
3941
this.props.setError('ERROR', JSON.stringify(err));
4042
}
4143
}

demo/graph-tutorial/src/ErrorMessage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import React from 'react';
66
import { Alert } from 'reactstrap';
77

88
interface ErrorMessageProps {
9-
debug : string;
10-
message : string;
9+
debug: string;
10+
message: string;
1111
}
1212

1313
export default class ErrorMessage extends React.Component<ErrorMessageProps> {

demo/graph-tutorial/src/NavBar.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,33 @@ import {
1717
UncontrolledDropdown,
1818
DropdownToggle,
1919
DropdownMenu,
20-
DropdownItem } from 'reactstrap';
20+
DropdownItem
21+
} from 'reactstrap';
2122
import '@fortawesome/fontawesome-free/css/all.css';
2223

2324
interface NavBarProps {
24-
isAuthenticated : boolean;
25-
authButtonMethod : any;
26-
user : any;
25+
isAuthenticated: boolean;
26+
authButtonMethod: any;
27+
user: any;
2728
}
2829

2930
interface NavBarState {
30-
isOpen : boolean;
31+
isOpen: boolean;
3132
}
3233

3334
function UserAvatar(props: any) {
3435
// If a user avatar is available, return an img tag with the pic
3536
if (props.user.avatar) {
3637
return <img
37-
src={props.user.avatar} alt="user"
38-
className="rounded-circle align-self-center mr-2"
39-
style={{width: '32px'}}></img>;
38+
src={props.user.avatar} alt="user"
39+
className="rounded-circle align-self-center mr-2"
40+
style={{ width: '32px' }}></img>;
4041
}
4142

4243
// No avatar available, return a default icon
4344
return <i
44-
className="far fa-user-circle fa-lg rounded-circle align-self-center mr-2"
45-
style={{width: '32px'}}></i>;
45+
className="far fa-user-circle fa-lg rounded-circle align-self-center mr-2"
46+
style={{ width: '32px' }}></i>;
4647
}
4748

4849
function AuthNavItem(props: NavBarProps) {
@@ -52,7 +53,7 @@ function AuthNavItem(props: NavBarProps) {
5253
return (
5354
<UncontrolledDropdown>
5455
<DropdownToggle nav caret>
55-
<UserAvatar user={props.user}/>
56+
<UserAvatar user={props.user} />
5657
</DropdownToggle>
5758
<DropdownMenu right>
5859
<h5 className="dropdown-item-text mb-0">{props.user.displayName}</h5>

demo/graph-tutorial/src/Welcome.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55
import React from 'react';
66
import {
77
Button,
8-
Jumbotron } from 'reactstrap';
8+
Jumbotron
9+
} from 'reactstrap';
910

1011
interface WelcomeProps {
11-
isAuthenticated : boolean;
12-
authButtonMethod : any;
13-
user : any;
12+
isAuthenticated: boolean;
13+
authButtonMethod: any;
14+
user: any;
1415
}
1516

1617
interface WelcomeState {
17-
isOpen : boolean;
18+
isOpen: boolean;
1819
}
1920

2021
function WelcomeContent(props: WelcomeProps) {
@@ -38,7 +39,7 @@ export default class Welcome extends React.Component<WelcomeProps, WelcomeState>
3839
<Jumbotron>
3940
<h1>React Graph Tutorial</h1>
4041
<p className="lead">
41-
This sample app shows how to use the Microsoft Graph API to access Outlook and OneDrive data from React
42+
This sample app shows how to use the Microsoft Graph API to access Outlook and OneDrive data from React
4243
</p>
4344
<WelcomeContent
4445
isAuthenticated={this.props.isAuthenticated}

demo/graph-tutorial/src/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import './index.css';
44
import App from './App';
55
import * as serviceWorker from './serviceWorker';
66

7-
ReactDOM.render(<App />, document.getElementById('root'));
7+
ReactDOM.render(
8+
<React.StrictMode>
9+
<App />
10+
</React.StrictMode>,
11+
document.getElementById('root')
12+
);
813

914
// If you want your app to work offline and load faster, you can change
1015
// unregister() to register() below. Note this comes with some pitfalls.

0 commit comments

Comments
 (0)