Browse Source

Market done

Illia Kozyr 1 năm trước cách đây
mục cha
commit
3b858fae74
1 tập tin đã thay đổi với 8 bổ sung3 xóa
  1. 8 3
      Market GraphQL + Redux/script.js

+ 8 - 3
Market GraphQL + Redux/script.js

@@ -349,8 +349,9 @@ const actionOrder = () => async (dispatch, getState) => {
     if (result?._id) {
         dispatch(actionCartClear());
         document.location.hash = "#/cart/";
-        alert("Поздравляем, вы оформили заказ!");
+        alert("Purchase completed")
     }
+
 };
 
 const orderHistory = () =>
@@ -495,7 +496,7 @@ bPoput.className = "b-popup";
 bPoput.id = "b-popup";
 const bPoputContainer = document.createElement("div");
 bPoputContainer.className = "b-popup-content";
-bPoputContainer.id = "b-popup-content";
+bPoputContainer.id = "bPopupContent";
 const buttonGoodDeleteBlock = document.createElement("div");
 buttonGoodDeleteBlock.id = "buttonGoodDeleteBlock";
 
@@ -523,10 +524,14 @@ const buttonBuy = document.createElement("button");
 buttonBuy.className = "buttonBuy";
 buttonBuy.id = "buttonBuy";
 
+const a = document.createElement('p')
+a.innerHTML = "clear"
 store.subscribe(() => {
     divToCardBlock.innerHTML = "";
     goodByIdPrice.innerHTML = "";
     const toCartById = store.getState().cart;
+    
+    
     let countSum = 0;
     let priceSum = 0;
     for (let value of Object.values(toCartById)) {
@@ -573,6 +578,7 @@ store.subscribe(() => {
         buttonBuy.onclick = () => {
             store.dispatch(actionOrder());
             store.dispatch(orderHistory());
+
         };
 
         buttonPlus.onclick = () => store.dispatch(actionCartAdd(value.good));
@@ -728,7 +734,6 @@ store.subscribe(() => {
 
         for (let [key, value] of Object.entries(history.payload)) {
             const { _id, createdAt, total, orderGoods } = value;
-            console.log(total, "this");
             const h2 = document.createElement("h2");
             h2.className = "h2History"
             const dateOfOrder = new Date(+createdAt);