Commit 63a723ef authored by prumde's avatar prumde

Inserted wishlist in store.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174448 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7bd555db
...@@ -6,7 +6,7 @@ import { HttpModule } from '@angular/http'; ...@@ -6,7 +6,7 @@ import { HttpModule } from '@angular/http';
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
//import { JwtHelper } from 'angular2-jwt'; //For Future //import { JwtHelper } from 'angular2-jwt'; //For Future
import {CATEGORY,SUBCATEGORY,ITEM,ECM_LOCATION, CART_ITEMS} from './ecm-store/ecm-store'; import {CATEGORY,SUBCATEGORY,ITEM,ECM_LOCATION, CART_ITEMS, WISHLIST_ITEMS} from './ecm-store/ecm-store';
import {StoreModule} from '@ngrx/store'; import {StoreModule} from '@ngrx/store';
import { MaterialModule } from '@angular/material'; import { MaterialModule } from '@angular/material';
...@@ -114,7 +114,7 @@ const appRoutes: Routes = [ ...@@ -114,7 +114,7 @@ const appRoutes: Routes = [
HttpModule, HttpModule,
RouterModule.forRoot(appRoutes), RouterModule.forRoot(appRoutes),
ReactiveFormsModule, ReactiveFormsModule,
StoreModule.provideStore({CATEGORY,SUBCATEGORY,ITEM, location: ECM_LOCATION, cart: CART_ITEMS}), StoreModule.provideStore({CATEGORY,SUBCATEGORY,ITEM, location: ECM_LOCATION, cart: CART_ITEMS, wishlist: WISHLIST_ITEMS}),
MaterialModule, MaterialModule,
BrowserAnimationsModule BrowserAnimationsModule
], ],
......
...@@ -9,4 +9,5 @@ export class EcmStoreModel { ...@@ -9,4 +9,5 @@ export class EcmStoreModel {
ECM_LOCATION: EcmLocation; ECM_LOCATION: EcmLocation;
CART_COUNTER: number; CART_COUNTER: number;
CART_ITEMS: Item; CART_ITEMS: Item;
WISHLIST_ITEMS: Item;
}; };
...@@ -76,6 +76,33 @@ export function CART_ITEMS (state:any = [], action: Action) { ...@@ -76,6 +76,33 @@ export function CART_ITEMS (state:any = [], action: Action) {
} }
}; };
export const ADD_TO_WISHLIST = 'ADD_TO_WISHLIST';
export const REMOVE_WISLIST = 'REMOVE_WISLIST';
export const RESET_WISHLIST = 'RESET_WISHLIST';
export function WISHLIST_ITEMS (state:any = [], action: Action) {
switch (action.type) {
case ADD_TO_WISHLIST:
const item:Item = action.payload;
return [ ...state, item ];
case REMOVE_WISLIST:
console.log('Delete--WISHLIST---');
console.log(JSON.stringify(action.payload));
return state.filter(item => {
return item.itemCode !== action.payload.itemCode;
});
case RESET_WISHLIST:
console.log('RESET----WISHLIST---');
return state=[];
default:
return state;
}
};
export function ECM_LOCATION (state: any = null, {type, payload}) { export function ECM_LOCATION (state: any = null, {type, payload}) {
switch (type) { switch (type) {
case 'ECMLOCATION': case 'ECMLOCATION':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment