You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

29 lines
660 B

import React, { useEffect, useState } from 'react'
import { getSession } from '../api'
type Props = {
clientId: string
}
export const SessionPictures = ({ clientId }: Props) => {
const [pics, setPics] = useState<string[] | null>(null)
useEffect(() => {
const get = async () => {
if (pics) return
const previewPics = await getSession(clientId)
if (previewPics) setPics(previewPics)
}
const interval = setInterval(get, 300)
return () => clearInterval(interval)
}, [clientId, pics])
return (
<div>
<h3>Session Pictures</h3>
{pics && pics.map((src) => <img id={src} src={src} />)}
</div>
)
}