Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. componentDidMount() {
  2. const select = ['ServerRelativeUrl', 'Title'];
  3. this.sp.getSubwebsFilteredForCurrentUser()
  4. .select(...select)
  5. .get()
  6. .then(projects => {
  7. const configuredProjects = [];
  8. projects.map(project => {
  9. const endOfThePage = project.ServerRelativeUrl.split('/')[2];
  10. const projectPage = new pnp.Web(`XXX`);
  11. projectPage.lists.getByTitle('Strony witryny')
  12. .items
  13. .select('BannerImageUrl', 'Description', 'Czy_x0020_promowany_x003F_', 'Czy_x0020_prywatny_x003F_', 'Tagi', 'Zrealizowany')
  14. .filter("Title eq 'Strona główna'")
  15. .filter("Czy_x0020_prywatny_x003F_ eq 'False'")
  16. .getAll()
  17. .then(items => {
  18. items.map(item => {
  19. const singleProject = {
  20. "Title" : project.Title,
  21. "Informations" : item
  22. };
  23. configuredProjects.push(singleProject);
  24. })
  25. })
  26. })
  27. return Promise.all(configuredProjects.map((p, index) => ({...p, index})));
  28. })
  29. .then(configuredProjects => {
  30. console.log('Then configured projects', configuredProjects);
  31. })
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement