feat(search-button): add empty check
This commit is contained in:
parent
1fcd64ad42
commit
40f551c426
|
@ -51,7 +51,7 @@ const SearchImages = ({
|
||||||
|
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
const images = data.images;
|
const images = data.images ?? [];
|
||||||
setImages(images);
|
setImages(images);
|
||||||
setSlides(
|
setSlides(
|
||||||
images.map((image: Image) => {
|
images.map((image: Image) => {
|
||||||
|
|
|
@ -64,7 +64,7 @@ const Searchvideos = ({
|
||||||
|
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
const videos = data.videos;
|
const videos = data.videos ?? [];
|
||||||
setVideos(videos);
|
setVideos(videos);
|
||||||
setSlides(
|
setSlides(
|
||||||
videos.map((video: Video) => {
|
videos.map((video: Video) => {
|
||||||
|
|
Loading…
Reference in New Issue