Skip to content

Commit c43ee3d

Browse files
Lec39
1 parent 5721c56 commit c43ee3d

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/pages/checkout/checkout.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Component } from '@angular/core';
2-
import { NavController, NavParams } from 'ionic-angular';
2+
import { NavController, NavParams, AlertController } from 'ionic-angular';
33
import { Storage } from '@ionic/storage';
44
import * as WC from 'woocommerce-api';
5+
import { HomePage } from '../home/home';
56

67
@Component({
78
selector: 'page-checkout',
@@ -16,7 +17,7 @@ export class Checkout {
1617
billing_shipping_same: boolean;
1718
userInfo: any;
1819

19-
constructor(public navCtrl: NavController, public navParams: NavParams, public storage: Storage) {
20+
constructor(public navCtrl: NavController, public navParams: NavParams, public storage: Storage, public alertCtrl: AlertController) {
2021
this.newOrder = {};
2122
this.newOrder.billing_address = {};
2223
this.newOrder.shipping_address = {};
@@ -110,7 +111,18 @@ export class Checkout {
110111

111112
this.WooCommerce.postAsync("orders", orderData).then( (data) => {
112113

113-
console.log(JSON.parse(data.body).order);
114+
let response = (JSON.parse(data.body).order);
115+
116+
this.alertCtrl.create({
117+
title: "Order Placed Successfully",
118+
message: "Your order has been placed successfully. Your order number is " + response.order_number,
119+
buttons: [{
120+
text: "OK",
121+
handler: () => {
122+
this.navCtrl.setRoot(HomePage);
123+
}
124+
}]
125+
}).present();
114126

115127
})
116128

0 commit comments

Comments
 (0)