🥳
This commit is contained in:
29
client/src/pages/SessionPictures.tsx
Normal file
29
client/src/pages/SessionPictures.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
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>
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user