fix: info defaults

This commit is contained in:
Mateusz Pstrucha committed 2021-09-09 00:05:01 +02:00
1 parent bdcf80b0d2
commit ec6b227d85
4 files changed
+16 -9

No files matched your search

+1 -1
View File
@@ -37,4 +37,4 @@ function search(query) {
})
}
export { tracks, get, getMultiple, download, search }
export { tracks, get, getMultiple, search }
+4 -1
View File
@@ -8,7 +8,10 @@
}
.info-image {
height: min(20vh, 60vw);
--side: min(20vh, 60vw);
height: var(--side);
width: var(--side);
flex-shrink: 0;
margin: auto;
margin-bottom: 1em;
box-shadow: 0px 4px 16px 0px #000000b8;
+7 -3
View File
@@ -1,17 +1,21 @@
import { useEffect, useState } from 'react'
import { useParams } from 'react-router-dom'
import { get, download } from '../../Cache'
import { get } from '../../Cache'
import './Info.css'
function Info() {
const { id } = useParams(),
[track, setTrack] = useState({ votes: {}, album: {}, artists: [] })
[track, setTrack] = useState({
title: 'Tytuł',
votes: {},
album: {},
artists: ['Autor'],
})
useEffect(() => {
get(id).then((track) => {
console.log('get', track)
setTrack(track)
})
}, [id])
+4 -4
View File
@@ -13,7 +13,7 @@ import Info from '../Info/Info'
import Top from '../Top/Top'
import Search from '../Search/Search'
import { get, download } from '../../Cache'
import { get } from '../../Cache'
import PlayingContext from '../../contexts/Playing'
@@ -30,11 +30,11 @@ function Main() {
[top, setTop] = useState([])
useEffect(() => {
download('3OcyTN8Nz3bdne5aq9mMR5').then((track) => {
get('3OcyTN8Nz3bdne5aq9mMR5').then((track) => {
setPlaying(track)
setNext(track)
setPrevious([track, track, track])
setTop([track, track])
setPrevious([track])
setTop([track])
})
}, [])