learnmore bug fixed
This commit is contained in:
@@ -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} */}
|
||||
|
||||
Reference in New Issue
Block a user