makstravm 3 роки тому
батько
коміт
fbab8ce7eb
1 змінених файлів з 3 додано та 3 видалено
  1. 3 3
      HW18/main.js

+ 3 - 3
HW18/main.js

@@ -169,7 +169,7 @@ const actionLogin = (login, password) =>
 const actionMyOrders = () =>
     actionPromise('orderGood', gql(`query Order{
                                         OrderGoodFind(query:"[{}]"){
-                                        good{ name } _id total price count
+                                        good{ name _id } _id total price count
                                     }
 }`, {}))
 
@@ -337,7 +337,7 @@ store.subscribe(() => {
     if (orderGood?.payload && route === 'order') {
         main.innerHTML = ''
         const table = document.createElement('table')
-        for (const { good, price, count, total } of orderGood.payload) {
+        for (const { _id, good, price, count, total } of orderGood.payload) {
             if (good !== null) {
 
                 const tr = document.createElement('tr')
@@ -346,7 +346,7 @@ store.subscribe(() => {
                 const tdCount = document.createElement('td')
                 const tdTotal = document.createElement('td')
 
-                tdName.innerText = good.name
+                tdName.innerHTML = `<a href="#/good/${good._id}">${good.name}</a>`
                 tdPrice.innerText = price
                 tdCount.innerText = count
                 tdTotal.innerText = total