(token, tracksEndPoint)
| 48 | |
| 49 | // Function to get tracks |
| 50 | const _getTracks = async (token, tracksEndPoint) => { |
| 51 | const limit = 10 |
| 52 | |
| 53 | const result = await fetch(`${tracksEndPoint}?limit=${limit}`, { |
| 54 | method: 'GET', |
| 55 | headers: { Authorization: 'Bearer ' + token }, |
| 56 | }) |
| 57 | |
| 58 | const data = await result.json() |
| 59 | return data.items |
| 60 | } |
| 61 | |
| 62 | // Function to get individual track |
| 63 | const _getTrack = async (token, trackEndPoint) => { |