Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as JavaScript by 123 ( 7 years ago )
_all_playlist_render ()
  {       
    let cA = new cyberAuth();
    let ownerId = localStorage.getItem('userId')  
    let id_token = localStorage.getItem('id_token') ;
    let tabInsert = [];
    let selectedTab = '';
      (async () => {
        //get users playlists and contents
        const [playlists, contents] = await Promise.all([
          axios.get(cA.domain + '/playlists/user/' + ownerId,{
            headers: {
              Authorization: 'Bearer ' + id_token
            }
          }),
          axios.get(cA.domain + '/contents/user/' + ownerId,{
            headers: {
              Authorization: 'Bearer ' + id_token 
            }
          })  
        ]);
        this.setState({ contents : contents.data.content});
        this.setState({ playlists : playlists.data.playlist});        
        console.log(contents.data.content);
        console.log(playlists.data.playlist);                
        this.setState({selectedTab: playlists.data.playlist[0].playlistKey});
        
        playlists.data.playlist.forEach((playlist) => {
          tabInsert.push(
            (<Tab key={playlist.playlistKey} title={playlist.playlistName}  >
             <Row className="icon-cards-row mb-6">
            <Colxx xxs="6" sm="6" md="6" lg="6" >
                <Card className="mb-4">
                  <CardBody className="text-center">
                    <i className="iconsmind-Stopwatch" />
                    <p className="card-text font-weight-semibold mb-0">Total Time</p>
                    <p className="lead text-center">{playlist.playlistDuration}</p>
                  </CardBody>
                </Card>
              </Colxx>

              <Colxx xxs="6" sm="6" md="6" lg="6">
                <Card className="mb-4">
                  <CardBody className="text-center">
                    <i className="iconsmind-Clapperboard-Close" />
                    <p className="card-text font-weight-semibold mb-0">Last Played</p>                    
                    <p className="lead text-center">{moment(playlist.last_played).format('YYYY-MM-DD hh:mm a')}</p>
                  </CardBody>
                </Card>
              </Colxx>
              </Row>
            <Row>
              <Colxx md="12" className="mb-4">
                <Card className="mb-4">
              <CardBody>
                <p>itemz</p>                       
              </CardBody>
            </Card>
              </Colxx>
            </Row>
          </Tab>)
          );       
      });

        this.setState({
          tabs: tabInsert
        });   
        
      })();    
  }

 

Revise this Paste

Children: 96819
Your Name: Code Language: