Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- componentWillMount() {
- axios.get(process.env.REACT_APP_API_URL + `/index.php/paketmitra/detailPaketMitra`)
- .then((response) => {
- console.log(response.data.data)
- let jumlahBeratNya = 0;
- let subTotal = 0;
- let beratProduk = [];
- let paketMitra = this.state.dataPaketMitra.map((item, i) => {
- jumlahBeratNya += Number(item.produk.berat_kemasan);
- beratProduk[i] = Number(item.produk.berat_kemasan);
- subTotal += Number(item.subtotal);
- })
- this.setState({
- dataPaketMitra: response.data.data,
- jumlahBerat: jumlahBeratNya,
- beratPerProduk: beratProduk,
- jumlahHarga: subTotal,
- keranjangTotalHarga: subTotal
- })
- }).catch((error) => {
- toast.error("Gagal Mendapatkan Paket Mitra :(")
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement