Improves the method binding in the source code

This commit is contained in:
Patrick Lamber 2020-05-04 18:18:01 +02:00
parent 14831357d9
commit 0b4ee5e570
1 changed files with 16 additions and 20 deletions

View File

@ -1,22 +1,18 @@
import * as React from 'react';
import styles from './GraphConsumer.module.scss';
import * as strings from 'GraphConsumerWebPartStrings'; import * as strings from 'GraphConsumerWebPartStrings';
import {
BaseButton, Button, CheckboxVisibility, DetailsList, DetailsListLayoutMode, PrimaryButton,
SelectionMode, TextField
} from 'office-ui-fabric-react';
import * as React from 'react';
import { AadHttpClient, MSGraphClient } from '@microsoft/sp-http';
import { escape } from '@microsoft/sp-lodash-subset';
import { ClientMode } from './ClientMode';
import styles from './GraphConsumer.module.scss';
import { IGraphConsumerProps } from './IGraphConsumerProps'; import { IGraphConsumerProps } from './IGraphConsumerProps';
import { IGraphConsumerState } from './IGraphConsumerState'; import { IGraphConsumerState } from './IGraphConsumerState';
import { ClientMode } from './ClientMode';
import { IUserItem } from './IUserItem'; import { IUserItem } from './IUserItem';
import { escape } from '@microsoft/sp-lodash-subset';
import {
PrimaryButton,
TextField,
DetailsList,
DetailsListLayoutMode,
CheckboxVisibility,
SelectionMode,
BaseButton,
Button
} from 'office-ui-fabric-react';
import { AadHttpClient, MSGraphClient } from "@microsoft/sp-http";
// Configure the columns for the DetailsList component // Configure the columns for the DetailsList component
let _usersListColumns = [ let _usersListColumns = [
@ -119,7 +115,7 @@ export default class GraphConsumer extends React.Component<IGraphConsumerProps,
}); });
} }
private _getSearchForErrorMessage(value: string): string { private _getSearchForErrorMessage = (value: string): string => {
// The search for text cannot contain spaces // The search for text cannot contain spaces
return (value == null || value.length == 0 || value.indexOf(" ") < 0) return (value == null || value.length == 0 || value.indexOf(" ") < 0)
? '' ? ''
@ -136,12 +132,12 @@ export default class GraphConsumer extends React.Component<IGraphConsumerProps,
this._searchWithAad(); this._searchWithAad();
break; break;
case ClientMode.graph: case ClientMode.graph:
this._searchWithGraph(); this._searchWithGraph();
break; break;
} }
} }
private _searchWithAad(): void { private _searchWithAad = (): void => {
// Log the current operation // Log the current operation
console.log("Using _searchWithAad() method"); console.log("Using _searchWithAad() method");
@ -189,7 +185,7 @@ export default class GraphConsumer extends React.Component<IGraphConsumerProps,
}); });
} }
private _searchWithGraph(): void { private _searchWithGraph = () : void => {
// Log the current operation // Log the current operation
console.log("Using _searchWithGraph() method"); console.log("Using _searchWithGraph() method");