mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
improve loading
This commit is contained in:
parent
dfe8966d9d
commit
32ac0fadc4
@ -35,9 +35,12 @@ const LivestreamItem = (props) => {
|
||||
}
|
||||
|
||||
export default (props) => {
|
||||
const [loading, setLoading] = React.useState(true)
|
||||
const [list, setList] = React.useState([])
|
||||
|
||||
const loadStreamings = async () => {
|
||||
setLoading(true)
|
||||
|
||||
const livestreams = await Livestream.getLivestreams().catch((err) => {
|
||||
console.error(err)
|
||||
app.message.error("Failed to load livestreams")
|
||||
@ -46,6 +49,8 @@ export default (props) => {
|
||||
|
||||
console.log("Livestreams", livestreams)
|
||||
|
||||
setLoading(false)
|
||||
|
||||
if (livestreams) {
|
||||
if (!Array.isArray(livestreams)) {
|
||||
console.error("Livestreams is not an array")
|
||||
@ -65,6 +70,10 @@ export default (props) => {
|
||||
}
|
||||
|
||||
const renderList = () => {
|
||||
if (loading) {
|
||||
return <antd.Skeleton active />
|
||||
}
|
||||
|
||||
if (list.length === 0) {
|
||||
return <antd.Result>
|
||||
<h1>
|
||||
|
Loading…
x
Reference in New Issue
Block a user