title: Why is my array returning undefined after post request?
body: <p>I have a function that adds a detail into an array of details and a second function that makes the post request to the server. The first time i run addDetail() and then addOrder() the console.log() inside addDetail() shows an array. But the second time that i want to run both functions without reloading the page, the console.log() inside addDetail() returns undefined.</p>
  
  <p>In clearOrder() at the end of addOrder() i set the array to empty: this.order.details=[];</p>
  
  <pre><code>async addDetail() {
    let leave = 0;
    try {
      const response = await axios.get(
        `product/products/${this.detailProduct}`
      );
      const product = response.data.product;
  
      const data = {
        product: product.name,
        quantity: this.detailQuantity,
        aggregateDiscount: this.detailAggregateDiscount,
        price: parseFloat(
          (
            product.finalPrice * this.detailQuantity -
            (product.finalPrice *
              this.detailQuantity *
              this.detailAggregateDiscount) /
              100
          ).toFixed(2)
        )
      };
      this.order.total += data.price;
      let num = parseFloat(this.order.total.toFixed(2));
      this.order.total = num;
      this.order.details.push(data);
      **console.log(this.order.details);** // returns undefined the second time
      this.detailProduct = "";
      this.detailQuantity = 1;
      this.detailAggregateDiscount = 0;
    } catch (err) {
      errorAlertHandler(err, "No encontrado");
    }
  },
  
  
  async addOrder() {
      const data = {
        number: this.totalOrders + 1,
        description: this.order.description,
        customer: this.order.customer,
        deliveryDate: this.order.deliveryDate,
        details: this.order.details,
        total: this.order.total,
        deposit: this.order.deposit,
        status: this.order.status
      };
      try {
        await axios.post(`/order/add`, data);
        this.dialog = false;
        this.dialog2 = false;
        this.getOrders();
        this.clearOrder();
        this.$store.dispatch("showAlert", {
          status: true,
          type: "success",
          text: "Pedido creado"
        });
      } catch (err) {
        errorAlertHandler(err, "No encontrado");
      }
  },
  </code></pre>