Skip to content

Commit 767348e

Browse files
Lec54-55-56
1 parent a11d534 commit 767348e

File tree

5 files changed

+20
-25
lines changed

5 files changed

+20
-25
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"@ionic/app-scripts": "1.3.0",
4545
"@ionic/cli-plugin-cordova": "1.6.2",
4646
"@ionic/cli-plugin-ionic-angular": "1.4.1",
47-
"ionic": "3.10.3",
47+
"ionic": "3.19.0",
4848
"typescript": "~2.2.1"
4949
},
5050
"cordovaPlugins": [
@@ -71,4 +71,4 @@
7171
"onesignal-cordova-plugin": {}
7272
}
7373
}
74-
}
74+
}

src/app/app.module.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { PayPal } from '@ionic-native/paypal';
1919
// import { SearchPage } from '../pages/search/search';
2020
import { IonicStorageModule } from '@ionic/storage';
2121
import { OneSignal } from "@ionic-native/onesignal";
22-
import { WooCommerceProvider } from '../providers/woocommerce/woocommerce';
22+
import { WoocommerceProvider } from '../providers/woocommerce/woocommerce';
2323

2424
@NgModule({
2525
declarations: [
@@ -42,7 +42,8 @@ import { WooCommerceProvider } from '../providers/woocommerce/woocommerce';
4242
SplashScreen,
4343
PayPal,
4444
OneSignal,
45-
{provide: ErrorHandler, useClass: IonicErrorHandler}, WooCommerceProvider
45+
{provide: ErrorHandler, useClass: IonicErrorHandler},
46+
WoocommerceProvider
4647
]
4748
})
4849
export class AppModule {}

src/pages/home/home.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { IonicPage, NavController, Slides, ToastController } from 'ionic-angular
33
// import { ProductDetails } from '../product-details/product-details';
44

55
import * as WC from 'woocommerce-api';
6-
import { WooCommerceProvider } from '../../providers/woocommerce/woocommerce';
76
// import { SearchPage } from "../search/search";
7+
import { WoocommerceProvider } from '../../providers/woocommerce/woocommerce';
88

99
@IonicPage({})
1010
@Component({
@@ -21,15 +21,11 @@ export class HomePage {
2121

2222
@ViewChild('productSlides') productSlides: Slides;
2323

24-
constructor(public navCtrl: NavController, public toastCtrl: ToastController, private woocommerce: WooCommerceProvider) {
24+
constructor(public navCtrl: NavController, public toastCtrl: ToastController, private WP: WoocommerceProvider) {
2525

2626
this.page = 2;
2727

28-
this.WooCommerce = WC({
29-
url: "http://samarth.southeastasia.cloudapp.azure.com",
30-
consumerKey: "ck_978c83dd335e861046f05d4b5ae020ff00667044",
31-
consumerSecret: "cs_f06f888d7d3d9e02a09b4d40624f222af7b12bc9"
32-
});
28+
this.WooCommerce = WP.init();
3329

3430
this.loadMoreProducts(null);
3531

src/pages/menu/menu.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as WC from 'woocommerce-api';
77
// import { ProductsByCategory } from '../products-by-category/products-by-category'
88
import { Storage } from '@ionic/storage';
99
import { Cart } from '../cart/cart';
10+
import { WoocommerceProvider } from '../../providers/woocommerce/woocommerce';
1011

1112
@IonicPage({})
1213
@Component({
@@ -22,16 +23,12 @@ export class Menu {
2223
loggedIn: boolean;
2324
user: any;
2425

25-
constructor(public navCtrl: NavController, public navParams: NavParams, public storage: Storage, public modalCtrl: ModalController, private events: Events) {
26+
constructor(public navCtrl: NavController, public navParams: NavParams, public storage: Storage, public modalCtrl: ModalController, private events: Events, private WP: WoocommerceProvider) {
2627
this.homePage = 'HomePage';
2728
this.categories = [];
2829
this.user = {};
2930

30-
this.WooCommerce = WC({
31-
url: "http://samarth.southeastasia.cloudapp.azure.com",
32-
consumerKey: "ck_a55da2f5918a380ed8565ba180fb04f4ec67f304",
33-
consumerSecret: "cs_3a5776160220af80f004a6983942fc5e06de22a4"
34-
});
31+
this.WooCommerce = WP.init();
3532

3633

3734
this.WooCommerce.getAsync("products/categories").then((data) => {
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
import { Injectable } from '@angular/core';
22
import * as WC from 'woocommerce-api';
33

4+
45
@Injectable()
5-
export class WooCommerceProvider {
6+
export class WoocommerceProvider {
67

7-
WooCommerce: any;
8+
Woocommerce: any;
89

910
constructor() {
10-
this.WooCommerce = WC({
11-
url: "http://samarth.cloudapp.net",
12-
consumerKey: "ck_d6c5feec9ea1c407d2f91661c5137c6e3e48ae3b",
13-
consumerSecret: "cs_de8e6cf03a5afd10491dfb1756415ac5a0169ae8"
11+
this.Woocommerce = WC({
12+
url: "http://samarth.southeastasia.cloudapp.azure.com",
13+
consumerKey: "ck_a55da2f5918a380ed8565ba180fb04f4ec67f304",
14+
consumerSecret: "cs_3a5776160220af80f004a6983942fc5e06de22a4"
1415
});
1516
}
1617

17-
initialize(){
18-
return this.WooCommerce;
18+
init(){
19+
return this.Woocommerce;
1920
}
2021

2122
}

0 commit comments

Comments
 (0)