This commit is contained in:
E
2021-03-07 20:56:20 -07:00
parent 1e8d655d1d
commit b0aec2cfd1
5 changed files with 61 additions and 55 deletions

View File

@@ -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>
)
}