File size: 1,163 Bytes
f5071ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React, { useEffect, useState } from 'react'
import { useParams } from 'react-router-dom'
import fetchApi from "../utils/api"
import Skeleton from 'react-loading-skeleton' ;
import ArtistDetails from './ArtistDetails';

const Artist = () => {

    const {artistId} = useParams();
    console.log(artistId);

    const [loading,setLoading] = useState(false);
    const [artistDetails,setArtistDetails] = useState(null);

    async function getArtistDetail (){
        setLoading(true);
        const res = await fetchApi("artist_overview",`?id=${artistId}`)
        .then((res)=>{
            setArtistDetails(res);
            setLoading(false);
        })
        .catch((e)=>{
            console.log("ARTISTDETAIL error=>",e);
        })
    }

    useEffect(()=>{
        getArtistDetail();
    },[artistId]);

  return (
    <div className='artist w-[80%] pb-10 bg-[#121212] h-[calc(100%-130px)] overflow-y-auto right-0  fixed'>
      {
        !loading ? 
        (<ArtistDetails artistDetails={artistDetails} />) : 
        (<Skeleton className='ml-2 mr-5  w-[98%] mx-auto' count={5} height="10px" />)
      }
    </div>
  )
}

export default Artist