Add support for homepage

This commit is contained in:
Ari Gunawan 2021-07-05 08:08:00 +07:00
parent a3c0fc3b33
commit 1c650cab9b
3 changed files with 7 additions and 3 deletions

View File

@ -3,7 +3,7 @@
"solution": { "solution": {
"name": "react-pagecontributors-client-side-solution", "name": "react-pagecontributors-client-side-solution",
"id": "1c18830a-4c18-4b82-a571-77863b19c66d", "id": "1c18830a-4c18-4b82-a571-77863b19c66d",
"version": "1.1.0.0", "version": "1.2.0.0",
"skipFeatureDeployment": true, "skipFeatureDeployment": true,
"developer": { "developer": {
"name": "", "name": "",

View File

@ -28,11 +28,15 @@ export default class PagecontributionWebPart extends BaseClientSideWebPart<IPage
React.createElement(PageContributors, { React.createElement(PageContributors, {
personaSize: this.properties.personaSize, personaSize: this.properties.personaSize,
numberOfFaces: this.properties.numberOfFaces, numberOfFaces: this.properties.numberOfFaces,
pageUrl: this.properties.pageUrl pageUrl: this.properties.pageUrl || this.getCurrentPageRelativeUrl()
}) })
, this.domElement); , this.domElement);
} }
private getCurrentPageRelativeUrl(): string {
return this.context.pageContext.legacyPageContext.serverRequestPath;
}
protected get dataVersion(): Version { protected get dataVersion(): Version {
return Version.parse('1.0'); return Version.parse('1.0');
} }

View File

@ -160,7 +160,7 @@ export default class PageContributors extends React.Component<IPageContributorsP
} }
else if (Environment.type == EnvironmentType.SharePoint || else if (Environment.type == EnvironmentType.SharePoint ||
Environment.type == EnvironmentType.ClassicSharePoint) { Environment.type == EnvironmentType.ClassicSharePoint) {
PageContributorsService.getPageContributors(this.props.pageUrl || location.pathname).then( PageContributorsService.getPageContributors(this.props.pageUrl).then(
(response) => { (response) => {
this._setContributors(response); this._setContributors(response);
}, },