Forum Discussion
Debugging SPFx App Customizer
- Jun 19, 2017
Apparently there are some additional instuctions required for the PnP JS and SPFx to play nicely with one another. Thanks to Patrick Rodgers for pointing me to the missing key described in https://github.com/SharePoint/PnP-JS-Core/wiki/Using-sp-pnp-js-in-SharePoint-Framework#establish-context.
A single call in the onInit() method override does the trick:
@override public onInit(): Promise<void> { return super.onInit().then(_ => { //--- ensure that the current web is used for all pnp calls pnp.setup({ spfxContext: this.context }); }); }The REST call is now forming properly. It sure would be nice to have complete, organized documentation all together in ONE PLACE. :)
Thanks again for your interest and assistance.
Hi Joseph Ackerman,
I suspect that
pnp.sp.web.lists.getByTitle('OrangeLinks').items.select('URL').get().then((links: any) => {
...
}isn't returning any links.
Can you add console.log("started") at the beginning of the getOrangeLinks method to make sure that the method is called at all.
then can you add a console.log(links) to make sure that we get any results returned?