diff --git a/samples/react-add-js-css-ref/src/webparts/addJsCssReference/components/AddJsCssReference.tsx b/samples/react-add-js-css-ref/src/webparts/addJsCssReference/components/AddJsCssReference.tsx index a51f5e6ad..fe4a82061 100644 --- a/samples/react-add-js-css-ref/src/webparts/addJsCssReference/components/AddJsCssReference.tsx +++ b/samples/react-add-js-css-ref/src/webparts/addJsCssReference/components/AddJsCssReference.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import styles from './AddJsCssReference.module.scss'; -import { IAddJsCssReferenceProps } from './IAddJsCssReferenceProps'; import { TextField } from 'office-ui-fabric-react/lib/TextField'; import { ListView } from "@pnp/spfx-controls-react/lib/ListView"; import { MessageBarType, Link, Separator, CommandBarButton, IStackStyles, Text, MessageBar, PrimaryButton, DefaultButton, Dialog, DialogFooter, DialogType, Stack, IStackTokens, Icon, Spinner } from 'office-ui-fabric-react'; @@ -17,6 +16,7 @@ import { PermissionKind } from '@pnp/sp/presets/all'; //import { render } from 'react-dom'; import { getSP } from '../pnpjsConfig'; import { IJsCssItem } from '../../../models/IJsCssItem'; +import { WebPartContext } from '@microsoft/sp-webpart-base'; const stackTokens: IStackTokens = { childrenGap: 40 }; @@ -34,6 +34,11 @@ const theme: ITheme = createTheme({ const stackStyles: Partial = { root: { height: 30 } }; +export interface IAddJsCssReferenceProps { + description: string; + context: WebPartContext; +} + export interface IAddJsCssReferenceState { disableRegisterButton: boolean; disableRemoveButton: boolean; @@ -286,8 +291,8 @@ export default class AddJsCssReference extends React.Component { - await this.checkPermisson(); + public componentDidMount(): void { + this.checkPermisson(); } @@ -295,7 +300,6 @@ export default class AddJsCssReference extends React.Component { - const web = await this._sp.web(); - console.log(web); const customactions: any = await this._sp.web.userCustomActions(); console.log(customactions); const found = customactions.filter(item => item.Title === CustomActionTitle);