Skip to content

Commit

Permalink
첫번째 글자 검색 시 미 반영 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
sehyun0518 committed Feb 13, 2024
1 parent e37247a commit 79c058e
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/pages/SearchResultPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const SearchResult = () => {
return searchData.then(value => value.data.result);
})
const responses = await Promise.all(requests);
console.log(responses);
responses.forEach((response) => {
const ivideos = response.videos as IVideo[];
dataDuplicateHandler(ivideos, inputValues);
Expand Down Expand Up @@ -96,20 +97,18 @@ const SearchResult = () => {

const dataDuplicateHandler = (videos : IVideo[], check : string) => {
const newData = videos.filter((value) => {
return !data.some((item) => item.video_id === value.video_id);
}).map((video) => {
const formattedContent = formatContent(video.content, check);
const formattedTitle = formatContent(video.title, check);
const formattedDescription = formatContent(video.description, check)

return {
...video,
title: formattedTitle,
description : formattedDescription,
content: formattedContent
};
});
setData(data.concat(newData));
return !data.some((item) => item.video_id === value.video_id);
})
const mappingData = newData.map((video) => {
const markdata = {
...video,
title: formatContent(video.title, check),
description : formatContent(video.description, check),
content: formatContent(video.content, check)
};
setData([...data, markdata]);
});
mappingData;
}
const handleReSearch = () => {
const params = {
Expand Down

0 comments on commit 79c058e

Please sign in to comment.