Advertisement
Guest User

Untitled

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