DeJaVu před 3 roky
rodič
revize
71c5f17801
3 změnil soubory, kde provedl 5 přidání a 4 odebrání
  1. 3 2
      src/Components/CAdFeed.js
  2. 1 1
      src/actions/index.js
  3. 1 1
      src/pages/Home.js

+ 3 - 2
src/Components/CAdFeed.js

@@ -20,10 +20,11 @@ export const AdFeed=({_id, price, owner,title,description,images,comments}) => {
                 <p>{`${price ? price : "0"} грн.`}</p>
             </div> 
             <div>
-                <p>{comments || null}</p>
+                <p>{`Коментарии : ${comments ? comments[0]?.text : 'отсутвуют'}`}</p>
+                <p>{`От : ${comments ? comments[0].owner.login : '-'}`}</p>
             </div>   
         </div>
         </Container> 
     )
 }
-export const CAdfeed = connect(state=>({comments: state.promiseReducer.AdFind?.payload?.data?.AdFind.comments[0]?.owner}))(AdFeed)
+// export const CAdfeed = connect(state=>({comments: state.promiseReducer.AdFind?.payload?.data?.AdFind.comments[0]?.owner}))(AdFeed)

+ 1 - 1
src/actions/index.js

@@ -98,7 +98,7 @@ export const actionTypeAd = (_id,title) =>
                   url
                 }
                 comments {
-                  _id text owner { login} 
+                  _id text owner {login} answerTo { owner { login}}
                 }
               }
             }

+ 1 - 1
src/pages/Home.js

@@ -13,7 +13,7 @@ export const Home = ({getData,data2}) => {
     if(data2){
         return (
             <div>
-                {data2.map(ad => <AdFeed key={ad._id} _id = {ad. _id} price = {ad.price} title = {ad.title} description={ad.description} owner={ad.owner} images={ad.images} />)}
+                {data2.map(ad => <AdFeed key={ad._id} _id = {ad. _id} price = {ad.price} title = {ad.title} description={ad.description} owner={ad.owner} images={ad.images} comments={ad.comments} />)}
             </div>
         )
     }