learnmore bug fixed

This commit is contained in:
victorAnumudu
2025-06-10 17:17:20 +01:00
parent e3399d4b95
commit 4fc109926c
4 changed files with 55 additions and 55 deletions
+4 -4
View File
@@ -66,17 +66,17 @@ export default function LearnMore() {
})
//FUNCTION TO GET LEARN MORE TOPIC
useEffect(()=>{
apiCall.getLearnmoreTopics().then((res)=>{
if(res.data.internal_return < 0){ // success but no data
setTopics(prev => ({...prev, loading: false}))
return
}
const resData = res?.data?.result_list
const resData = res?.data?.result_list || []
console.log('resData', resData)
setTopics(prev => ({...prev, loading: false, data: resData}))
setTabs(prev => {
return prev.map((item, index) => ({...item, title:resData[index].topic}))
return prev?.map((item, index) => ({...item, title:resData[index]?.topic}))
})
setSelectedTab(resData[0].topic)
// console.log('RES', resData)
@@ -130,7 +130,7 @@ export default function LearnMore() {
<>
{(topics?.data && topics?.data?.length > 0) ?
<div dangerouslySetInnerHTML={{
__html: topics?.data?.filter(item => item.topic == selectedTab)[0]?.contents,
__html: topics?.data?.filter(item => item?.topic == selectedTab)[0]?.contents,
}} className='prose dark:text-white dark:bg-dark-white'
>
{/* {topics?.data?.filter(item => item.topic == selectedTab)[0]?.contents} */}