Added Service Interface

This commit is contained in:
petkir 2020-07-18 12:48:38 +02:00
parent e370e40f8b
commit 36133a9c2b
3 changed files with 13 additions and 2 deletions

View File

@ -0,0 +1,9 @@
import { PeoplePickerEntity } from '@pnp/sp';
export interface ISPServices {
getUserProperties(user: string): Promise<any>;
getUserProfileProperty(user: string, property: string): Promise<string>;
getUsers(searchUser: string): Promise<PeoplePickerEntity[]>;
searchUsers(searchString: string, searchFirstName: boolean);
}

View File

@ -3,9 +3,10 @@ import { graph } from "@pnp/graph";
import { sp, PeoplePickerEntity, ClientPeoplePickerQueryParameters, SearchQuery, SearchResults, SearchProperty, SortDirection } from '@pnp/sp'; import { sp, PeoplePickerEntity, ClientPeoplePickerQueryParameters, SearchQuery, SearchResults, SearchProperty, SortDirection } from '@pnp/sp';
import { PrincipalType } from "@pnp/sp/src/sitegroups"; import { PrincipalType } from "@pnp/sp/src/sitegroups";
import { isRelativeUrl } from "office-ui-fabric-react"; import { isRelativeUrl } from "office-ui-fabric-react";
import { ISPServices } from "./ISPServices";
export class spservices { export class spservices implements ISPServices {

View File

@ -22,6 +22,7 @@ import {
} from "office-ui-fabric-react"; } from "office-ui-fabric-react";
import { WebPartTitle } from "@pnp/spfx-controls-react/lib/WebPartTitle"; import { WebPartTitle } from "@pnp/spfx-controls-react/lib/WebPartTitle";
import { ISPServices } from "../../../SPServices/ISPServices";
const az: string[] = [ const az: string[] = [
"A", "A",
@ -62,7 +63,7 @@ export default class Directory extends React.Component<
IDirectoryProps, IDirectoryProps,
IDirectoryState IDirectoryState
> { > {
private _services: spservices = null; private _services: ISPServices = null;
constructor(props: IDirectoryProps) { constructor(props: IDirectoryProps) {
super(props); super(props);