🍊
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Spin } from 'antd'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { getSession } from '../api'
|
||||
import { getClient } from '../api'
|
||||
|
||||
type Props = {
|
||||
clientId: string
|
||||
@@ -11,8 +12,8 @@ export const SessionPictures = ({ clientId }: Props) => {
|
||||
useEffect(() => {
|
||||
const get = async () => {
|
||||
if (pics) return
|
||||
const previewPics = await getSession(clientId)
|
||||
if (previewPics) setPics(previewPics)
|
||||
const { photos } = await getClient(clientId)
|
||||
if (photos.length) setPics(photos)
|
||||
}
|
||||
|
||||
const interval = setInterval(get, 300)
|
||||
@@ -23,7 +24,11 @@ export const SessionPictures = ({ clientId }: Props) => {
|
||||
return (
|
||||
<div>
|
||||
<h3>Session Pictures</h3>
|
||||
{pics && pics.map((src) => <img id={src} src={src} />)}
|
||||
{pics ? (
|
||||
pics.map((src) => <img id={src} src={src} alt="lol" />)
|
||||
) : (
|
||||
<Spin />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user