I have got problem with response . json() return problem. I have got two methods one is Mocking List, and another is by JSON. Mock method works superb. but return from response.json()
returned me undefined values.
The records are the same like in list - 4, but for all columns it returned undefined.
Here is my code:
private _getMockListData(): Promise<ISPLists> {
return MockHttpList.get(this.context.pageContext.web.absoluteUrl).then(() => {
const listData: ISPLists = {
value:
[
{ Tytuł1: 'WP', Link1: 'www.wp.pl', Link_zdjecie1: 'https://d.wpimg.pl/10002867-366860448/392x330.png'},
{ Tytuł1: 'Onet', Link1: 'www.onet.pl', Link_zdjecie1: 'https://upload.wikimedia.org/wikipedia/commons/b/b7/Onet_pl.png'},
{ Tytuł1: 'Interia', Link1: 'www.interia.pl', Link_zdjecie1: 'https://upload.wikimedia.org/wikipedia/commons/b/b7/Onet_pl.png'}
]
};
return listData;
}
) as Promise<ISPLists>;
}
private async _getListData(): Promise<ISPLists> {
return this.context.spHttpClient.get('https://sharepointTenant/sites/SharepointSite/_api/web/lists/GetByTitle(\'Wlasciwosci_toolbox\')/Items', SPHttpClient.configurations.v1)
.then((response: SPHttpClientResponse) => {
return response.json();
});
}
Please help me. Here is two code errors: