diff --git a/.vscode/settings.json b/.vscode/settings.json
index ad62e6f..9f7e852 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,7 +1,7 @@
{
- "window.zoomLevel": 2,
- "debug.console.fontSize": 15,
- "markdown.preview.fontSize": 15,
- "terminal.integrated.fontSize": 15,
- "editor.fontSize": 16.1
-}
\ No newline at end of file
+ "window.zoomLevel": 0.5,
+ "debug.console.fontSize": 14.1,
+ "markdown.preview.fontSize": 14.1,
+ "terminal.integrated.fontSize": 14.1,
+ "editor.fontSize": 14.1
+}
diff --git a/package-lock.json b/package-lock.json
index 70e9245..4c57ce6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,5 +1,5 @@
{
- "name": "NGRX-Course",
+ "name": "ngrx",
"version": "0.0.0",
"lockfileVersion": 1,
"requires": true,
@@ -1508,24 +1508,15 @@
}
},
"@ngrx/effects": {
- "version": "9.2.0",
- "resolved": "https://registry.npmjs.org/@ngrx/effects/-/effects-9.2.0.tgz",
- "integrity": "sha512-8V09zDIPehGpzgfcgyczelovsVYJvDQhN9wHt37K5A+YCG0CI8nj8FmKokHATwv/S62YqFrOVnr/TZacxpDhBw=="
- },
- "@ngrx/entity": {
- "version": "9.2.0",
- "resolved": "https://registry.npmjs.org/@ngrx/entity/-/entity-9.2.0.tgz",
- "integrity": "sha512-xSnS4EmksfvIobl2KMpljE1RMYuJGq7j5cCb9TnlsXkEc7cUa0TyGviSsxceSpk9WKtKARPR/AcVrVCESucF6Q=="
- },
- "@ngrx/router-store": {
- "version": "9.2.0",
- "resolved": "https://registry.npmjs.org/@ngrx/router-store/-/router-store-9.2.0.tgz",
- "integrity": "sha512-thu6aU9YWM64oNEk4Srx/mNSeQ2SPJKlTji8MSzfr06qgCMyPSXZBYlfs8HqY+af3eB7XBEhb/4ew4JJ6xC9zw=="
+ "version": "9.2.1",
+ "resolved": "https://registry.npmjs.org/@ngrx/effects/-/effects-9.2.1.tgz",
+ "integrity": "sha512-qWOnRYHdKzjCvcH6WOKra+KPlrMyS9ahoVvOSboJK7S3xzj9Pp5mgtcDBXqN9LlPbXDEzjZjFDJQMAtlP4c3Ig=="
},
"@ngrx/schematics": {
- "version": "9.2.0",
- "resolved": "https://registry.npmjs.org/@ngrx/schematics/-/schematics-9.2.0.tgz",
- "integrity": "sha512-jO3NNh2CJOxMaMyoBg/BqH/zyAeKZJFh97p14DojkfXx7Kc6NuIG04t+4xNe8X3sbdV2LIr6tr9P8nHAYHgMpA=="
+ "version": "13.0.2",
+ "resolved": "https://registry.npmjs.org/@ngrx/schematics/-/schematics-13.0.2.tgz",
+ "integrity": "sha512-84LwEv7MBTX49e1wjuXKgemxfmQUBdvfUKfPq7AmrTW99EtHHAuLYc+pL9XrbgKvkvVyVmDt+g6d3iw/80TZ1w==",
+ "dev": true
},
"@ngrx/store": {
"version": "9.2.0",
diff --git a/package.json b/package.json
index d9dc2d3..832b86b 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,5 @@
{
- "name": "NGRX-Course",
+ "name": "ngrx",
"version": "0.0.0",
"scripts": {
"ng": "ng",
@@ -37,18 +37,17 @@
"ngx-spinner": "^9.0.2",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
- "zone.js": "~0.10.2",
- "@ngrx/router-store": "^9.0.0",
- "@ngrx/entity": "^9.0.0"
+ "zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.901.0",
"@angular/cli": "~9.1.0",
"@angular/compiler-cli": "~9.1.0",
"@angular/language-service": "~9.1.0",
- "@types/node": "^12.11.1",
+ "@ngrx/schematics": "^13.0.2",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
+ "@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 4f90b14..0bb3cfa 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -24,12 +24,6 @@ import { environment } from '../environments/environment';
import { reducers, metaReducers } from './store';
import { EffectsModule } from '@ngrx/effects';
import { CustomerSupportEffects } from './store/effects/customer-support.effects';
-import { SpinnerEffects } from './store/effects/spinner.effects';
-import { AlertEffects } from './store/effects/alert.effects';
-import { RouteEffects } from './store/effects/route.effects';
-import { ModalEffects } from './store/effects/modal.effects';
-import { AppEffects } from './store/effects/app.effects';
-import { StoreRouterConnectingModule } from '@ngrx/router-store';
@NgModule({
declarations: [
@@ -69,17 +63,9 @@ import { StoreRouterConnectingModule } from '@ngrx/router-store';
},
}),
!environment.production ? StoreDevtoolsModule.instrument() : [],
- EffectsModule.forRoot([
- CustomerSupportEffects,
- SpinnerEffects,
- AlertEffects,
- RouteEffects,
- ModalEffects,
- AppEffects,
- ]),
- StoreRouterConnectingModule.forRoot(),
+ EffectsModule.forRoot([CustomerSupportEffects]),
],
providers: [],
bootstrap: [AppComponent],
})
-export class AppModule {}
+export class AppModule { }
diff --git a/src/app/modules/auth/auth.module.ts b/src/app/modules/auth/auth.module.ts
index cb46b45..f79d155 100644
--- a/src/app/modules/auth/auth.module.ts
+++ b/src/app/modules/auth/auth.module.ts
@@ -1,3 +1,7 @@
+import { AuthEffects } from './../../store/effects/auth.effects';
+import { EffectsModule } from '@ngrx/effects';
+import * as fromAuth from '../../store/reducers/auth.reducer';
+import { StoreModule } from '@ngrx/store';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
@@ -6,14 +10,14 @@ import { LoginComponent } from './login/login.component';
import { FormsModule } from '@angular/forms';
import { AuthLinksComponent } from './auth-links/auth-links.component';
import { LoginModalComponent } from './login-modal/login-modal.component';
-import { StoreModule } from '@ngrx/store';
-import * as fromAuth from '../../store/reducers/auth.reducer';
-import { EffectsModule } from '@ngrx/effects';
-import { AuthEffects } from '../../store/effects/auth.effects';
@NgModule({
- declarations: [LoginComponent, AuthLinksComponent, LoginModalComponent],
- imports: [CommonModule, AuthRoutingModule, FormsModule, StoreModule.forFeature(fromAuth.authFeatureKey, fromAuth.reducer), EffectsModule.forFeature([AuthEffects])],
+ declarations: [LoginComponent, AuthLinksComponent],
+ imports: [
+ CommonModule, AuthRoutingModule, FormsModule,
+ StoreModule.forFeature(fromAuth.authFeatureKey, fromAuth.reducer),
+ EffectsModule.forFeature([AuthEffects])
+ ],
exports: [AuthLinksComponent],
})
-export class AuthModule {}
+export class AuthModule { }
diff --git a/src/app/pages/customer-support/customer-support.component.html b/src/app/pages/customer-support/customer-support.component.html
index 5980b25..ec7227d 100644
--- a/src/app/pages/customer-support/customer-support.component.html
+++ b/src/app/pages/customer-support/customer-support.component.html
@@ -1,49 +1,50 @@
-
-
Customer Support
+
+
Customer Support
-
-
-
-
-
We are here to help!
-
-
-
-
\ No newline at end of file
+
+
+
+
diff --git a/src/app/pages/customer-support/customer-support.component.spec.ts b/src/app/pages/customer-support/customer-support.component.spec.ts
deleted file mode 100644
index 5a280c1..0000000
--- a/src/app/pages/customer-support/customer-support.component.spec.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { CustomerSupportComponent } from './customer-support.component';
-
-describe('CustomerSupportComponent', () => {
- let component: CustomerSupportComponent;
- let fixture: ComponentFixture;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- declarations: [ CustomerSupportComponent ]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(CustomerSupportComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
diff --git a/src/app/pages/customer-support/customer-support.component.ts b/src/app/pages/customer-support/customer-support.component.ts
index 9546c79..922891c 100644
--- a/src/app/pages/customer-support/customer-support.component.ts
+++ b/src/app/pages/customer-support/customer-support.component.ts
@@ -1,14 +1,12 @@
import { Component, OnInit } from '@angular/core';
import { NgForm } from '@angular/forms';
-import { CustomerSupportService } from 'src/app/shared/services/customer-support.service';
+import { select, Store } from '@ngrx/store';
import { Observable } from 'rxjs';
-import { Store, select } from '@ngrx/store';
-import { AppState } from 'src/app/store';
-import {
- sendingCustomerSupportMessage,
- clearForm,
-} from 'src/app/store/actions/customer-support.actions';
-import * as fromSelectors from 'src/app/store/selectors/customer-support.selectors';
+import { CustomerSupportService } from 'src/app/shared/services/customer-support.service';
+import * as FromCustomerActions from '../../store/actions/customer-support.actions';
+import { AppState } from './../../store/index';
+// tslint:disable-next-line: import-spacing
+import * as CustomerSelectors from '../../store/selectors/customer-support.selectors';
@Component({
selector: 'app-customer-support',
@@ -17,25 +15,23 @@ import * as fromSelectors from 'src/app/store/selectors/customer-support.selecto
})
export class CustomerSupportComponent implements OnInit {
constructor(
- private customerSupportService: CustomerSupportService,
private store: Store
- ) {}
+ ) { }
isSendSuccess: boolean | null = null;
- vm$: Observable;
+ cusData$: Observable;
ngOnInit(): void {
- this.vm$ = this.store.pipe(
- select(fromSelectors.selectCustomerSupportModel)
- );
+ this.cusData$ = this.store.pipe(select(CustomerSelectors.customerSupportData));
}
onSubmit(f: NgForm) {
- this.store.dispatch(sendingCustomerSupportMessage({ data: f.value }));
+ this.store.dispatch(FromCustomerActions.sendCustomerSupportMessage({ data: f.value }));
+ this.isSendSuccess = true;
}
clearFeedback() {
- this.store.dispatch(clearForm());
+ this.store.dispatch(FromCustomerActions.clearCustomerSupportStatus());
}
}
diff --git a/src/app/shared/services/customer-support.service.ts b/src/app/shared/services/customer-support.service.ts
index a81a702..98a48fe 100644
--- a/src/app/shared/services/customer-support.service.ts
+++ b/src/app/shared/services/customer-support.service.ts
@@ -11,9 +11,8 @@ export class CustomerSupportService {
// might be totally fake, and Some business logic usually handled on the server
// will be done on this page. This page is designed to give a back mock data.
/********************************************************************************** */
- constructor() {}
+ constructor() { }
- //This is a fake api call
sendMessage(form: CustomerMessage): Observable {
return form.name ? of(true) : of(false);
}
diff --git a/src/app/store/actions/auth.actions.ts b/src/app/store/actions/auth.actions.ts
index af5548d..103d434 100644
--- a/src/app/store/actions/auth.actions.ts
+++ b/src/app/store/actions/auth.actions.ts
@@ -1,29 +1,15 @@
import { createAction, props } from '@ngrx/store';
-import { User } from 'src/app/modules/auth/resources/auth';
-export const loginPage = createAction(
- '[Login Component] Login User',
- props<{ username: string; password: string }>()
+export const loadAuths = createAction(
+ '[Auth] Load Auths'
);
-export const loginModal = createAction(
- '[Login Modal Component] Login User',
- props<{ username: string; password: string }>()
+export const loadAuthsSuccess = createAction(
+ '[Auth] Load Auths Success',
+ props<{ data: any }>()
);
-export const loginSuccess = createAction(
- '[Auth Effect] Login User Success',
- props<{ user: User }>()
-);
-
-export const loginFailure = createAction(
- '[Auth Effect] Login User Failure',
+export const loadAuthsFailure = createAction(
+ '[Auth] Load Auths Failure',
props<{ error: any }>()
);
-
-export const logout = createAction('[Auth Links Component] Logout User');
-
-export const browserReload = createAction(
- '[Core Component] Browser Reload',
- props<{ user: User }>()
-);
diff --git a/src/app/store/actions/customer-support.actions.ts b/src/app/store/actions/customer-support.actions.ts
index 4f35cf8..f057b7b 100644
--- a/src/app/store/actions/customer-support.actions.ts
+++ b/src/app/store/actions/customer-support.actions.ts
@@ -1,16 +1,16 @@
-import { createAction, props } from '@ngrx/store';
import { CustomerMessage } from 'src/app/shared/models/customer-message';
+import { createAction, props } from '@ngrx/store';
-export const sendingCustomerSupportMessage = createAction(
+export const sendCustomerSupportMessage = createAction(
'[Customer Support Component] Sending Customer Support Message',
props<{ data: CustomerMessage }>()
);
-export const sendMessageStatus = createAction(
- '[Customer Support Effect] Send Customer Message Status',
+export const sendCustomerSupportStatus = createAction(
+ '[Customer Support Effect] Sending Customer Support Status',
props<{ isSentSuccess: boolean }>()
);
-export const clearForm = createAction(
- '[Customer Support Component] Clear Form'
+export const clearCustomerSupportStatus = createAction(
+ '[Customer Support Component] Clearing Customer Support Data'
);
diff --git a/src/app/store/effects/auth.effects.ts b/src/app/store/effects/auth.effects.ts
index b0d3706..64ed869 100644
--- a/src/app/store/effects/auth.effects.ts
+++ b/src/app/store/effects/auth.effects.ts
@@ -1,24 +1,30 @@
import { Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { catchError, map, concatMap } from 'rxjs/operators';
-import { EMPTY, of } from 'rxjs';
+import { Observable, EMPTY, of } from 'rxjs';
import * as AuthActions from '../actions/auth.actions';
-import { AuthService } from 'src/app/modules/auth/resources/auth.service';
+
+
@Injectable()
export class AuthEffects {
- login$ = createEffect(() => {
+
+ loadAuths$ = createEffect(() => {
return this.actions$.pipe(
- ofType(AuthActions.loginPage, AuthActions.loginModal),
- concatMap((action) =>
- this.authService.login(action.username, action.password).pipe(
- map((user) => AuthActions.loginSuccess({ user: user })),
- catchError((error) => of(AuthActions.loginFailure({ error })))
- )
+
+ ofType(AuthActions.loadAuths),
+ concatMap(() =>
+ /** An EMPTY observable only emits completion. Replace with your own observable API request */
+ EMPTY.pipe(
+ map(data => AuthActions.loadAuthsSuccess({ data })),
+ catchError(error => of(AuthActions.loadAuthsFailure({ error }))))
)
);
});
- constructor(private actions$: Actions, private authService: AuthService) {}
+
+
+ constructor(private actions$: Actions) { }
+
}
diff --git a/src/app/store/effects/customer-support.effects.ts b/src/app/store/effects/customer-support.effects.ts
index 84c5f27..7951390 100644
--- a/src/app/store/effects/customer-support.effects.ts
+++ b/src/app/store/effects/customer-support.effects.ts
@@ -1,27 +1,23 @@
import { Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
+import { map, mergeMap } from 'rxjs/operators';
import { CustomerSupportService } from 'src/app/shared/services/customer-support.service';
-import * as fromSupportActions from '../actions/customer-support.actions';
-import { mergeMap, map } from 'rxjs/operators';
+// tslint:disable-next-line: import-spacing
+import * as FromCustomerActions from '../actions/customer-support.actions';
@Injectable()
export class CustomerSupportEffects {
- sendMessage$ = createEffect(() => {
+
+ effectName$ = createEffect(() => {
return this.actions$.pipe(
- ofType(fromSupportActions.sendingCustomerSupportMessage),
+ ofType(FromCustomerActions.sendCustomerSupportMessage),
mergeMap((action) =>
- this.customerSupportService
- .sendMessage(action.data)
- .pipe(
- map((bool) =>
- fromSupportActions.sendMessageStatus({ isSentSuccess: bool })
- )
- )
- )
+ this.customerService.sendMessage(action.data).pipe(
+ map(msgSts => FromCustomerActions.sendCustomerSupportStatus({ isSentSuccess: msgSts }))
+ )
+ ),
);
});
- constructor(
- private actions$: Actions,
- private customerSupportService: CustomerSupportService
- ) {}
+
+ constructor(private actions$: Actions, private customerService: CustomerSupportService) { }
}
diff --git a/src/app/store/index.ts b/src/app/store/index.ts
index 6f1446f..985cd2f 100644
--- a/src/app/store/index.ts
+++ b/src/app/store/index.ts
@@ -1,45 +1,20 @@
-import {
- ActionReducer,
- ActionReducerMap,
- createFeatureSelector,
- createSelector,
- MetaReducer,
-} from '@ngrx/store';
-import { environment } from '../../environments/environment';
-import * as fromCustomerSupport from './reducers/customer-support.reducer';
-import * as fromAuth from './reducers/auth.reducer';
-import * as fromRouter from '@ngrx/router-store';
-import * as fromProduct from '../modules/products/state/product.reducer';
-
-export interface AppState {
- [fromCustomerSupport.customerSupportFeatureKey]: fromCustomerSupport.State;
-
- [fromAuth.authFeatureKey]: fromAuth.State;
-
- router: fromRouter.RouterReducerState;
- [fromProduct.productsFeatureKey]: fromProduct.State;
+import {
+ ActionReducerMap, MetaReducer, StoreModule
+} from '@ngrx/store';
+import { environment } from '../../environments/environment';
+import * as fromCustomerSupport from './reducers/customer-support.reducer';
+import * as fromAuth from './reducers/auth.reducer';
-}
-
-export const reducers: ActionReducerMap = {
- [fromCustomerSupport.customerSupportFeatureKey]: fromCustomerSupport.reducer,
-
- [fromAuth.authFeatureKey]: fromAuth.reducer,
-
- router: fromRouter.routerReducer,
-
- [fromProduct.productsFeatureKey]: fromProduct.reducer,
-};
-
-export const metaReducers: MetaReducer[] = !environment.production
- ? [debug]
- : [];
-
-export function debug(reducer: ActionReducer): ActionReducer {
- return function (state, action) {
- console.log('state', state);
- console.log('action', action);
-
- return reducer(state, action);
- };
-}
+
+export interface AppState {
+ [fromCustomerSupport.customerSupportFeatureKey]: fromCustomerSupport.State;
+ [fromAuth.authFeatureKey]: fromAuth.State;
+}
+
+export const reducers: ActionReducerMap = {
+ [fromCustomerSupport.customerSupportFeatureKey]: fromCustomerSupport.reducer,
+ [fromAuth.authFeatureKey]: fromAuth.reducer,
+};
+
+
+export const metaReducers: MetaReducer[] = !environment.production ? [] : [];
diff --git a/src/app/store/reducers/auth.reducer.ts b/src/app/store/reducers/auth.reducer.ts
index ab46799..8e09a1d 100644
--- a/src/app/store/reducers/auth.reducer.ts
+++ b/src/app/store/reducers/auth.reducer.ts
@@ -1,56 +1,21 @@
import { Action, createReducer, on } from '@ngrx/store';
import * as AuthActions from '../actions/auth.actions';
-import { User } from 'src/app/modules/auth/resources/auth';
export const authFeatureKey = 'auth';
export interface State {
- user: User;
- error: any;
+
}
export const initialState: State = {
- user: {
- id: null,
- username: null,
- email: null,
- isadmin: null,
- },
- error: null,
+
};
export const reducer = createReducer(
initialState,
- on(AuthActions.loginSuccess, AuthActions.browserReload, (state, action) => {
- return {
- ...state,
- user: action.user,
- error: null,
- };
- }),
- on(AuthActions.loginFailure, (state, action) => {
- return {
- ...state,
- user: {
- id: null,
- username: null,
- email: null,
- isadmin: null,
- },
- error: action.error,
- };
- }),
- on(AuthActions.logout, (state, action) => {
- return {
- ...state,
- user: {
- id: null,
- username: null,
- email: null,
- isadmin: null,
- },
- error: null,
- };
- })
+ on(AuthActions.loadAuths, state => state),
+ on(AuthActions.loadAuthsSuccess, (state, action) => state),
+ on(AuthActions.loadAuthsFailure, (state, action) => state),
+
);
diff --git a/src/app/store/reducers/customer-support.reducer.ts b/src/app/store/reducers/customer-support.reducer.ts
index fbb918b..6ea56c5 100644
--- a/src/app/store/reducers/customer-support.reducer.ts
+++ b/src/app/store/reducers/customer-support.reducer.ts
@@ -1,5 +1,7 @@
-import { Action, createReducer, on } from '@ngrx/store';
-import * as fromSupportActions from '../actions/customer-support.actions';
+import { createReducer, on } from '@ngrx/store';
+// tslint:disable-next-line: import-spacing
+import * as FromCustomerActions from '../actions/customer-support.actions';
+
export const customerSupportFeatureKey = 'customerSupport';
@@ -13,21 +15,22 @@ export const initialState: State = {
isSentSuccess: null,
};
+
export const reducer = createReducer(
initialState,
- on(fromSupportActions.sendingCustomerSupportMessage, (state, action) => {
+ on(FromCustomerActions.sendCustomerSupportMessage, (state, action) => {
return {
...state,
name: action.data.name,
};
}),
- on(fromSupportActions.sendMessageStatus, (state, action) => {
+ on(FromCustomerActions.sendCustomerSupportStatus, (state, action) => {
return {
...state,
isSentSuccess: action.isSentSuccess,
};
}),
- on(fromSupportActions.clearForm, (state) => {
+ on(FromCustomerActions.clearCustomerSupportStatus, (state) => {
return {
...state,
name: null,
diff --git a/src/app/store/selectors/auth.selectors.ts b/src/app/store/selectors/auth.selectors.ts
index 7e164bb..d0238e1 100644
--- a/src/app/store/selectors/auth.selectors.ts
+++ b/src/app/store/selectors/auth.selectors.ts
@@ -4,29 +4,3 @@ import * as fromAuth from '../reducers/auth.reducer';
export const selectAuthState = createFeatureSelector(
fromAuth.authFeatureKey
);
-
-export interface AuthLinksViewModal {
- isAdmin: boolean;
- isLoggedin: boolean;
-}
-
-export const selectIsLoggedIn = createSelector(
- selectAuthState,
- (state: fromAuth.State): boolean => state.user.id != null
-);
-
-export const selectIsAdmin = createSelector(
- selectAuthState,
- (state: fromAuth.State): boolean => state.user.isadmin
-);
-
-export const selectAuthLinksViewModel = createSelector(
- selectIsAdmin,
- selectIsLoggedIn,
- (isAdmin: boolean, isLoggedIn: boolean): AuthLinksViewModal => {
- return {
- isAdmin: isAdmin,
- isLoggedin: isLoggedIn,
- };
- }
-);
diff --git a/src/app/store/selectors/customer-support.selectors.ts b/src/app/store/selectors/customer-support.selectors.ts
index 5080333..11a4a33 100644
--- a/src/app/store/selectors/customer-support.selectors.ts
+++ b/src/app/store/selectors/customer-support.selectors.ts
@@ -1,28 +1,23 @@
import { createFeatureSelector, createSelector } from '@ngrx/store';
-import {
- State,
- customerSupportFeatureKey,
-} from '../reducers/customer-support.reducer';
+import { customerSupportFeatureKey, State } from '../reducers/customer-support.reducer';
-//Get feature from store
export const selectCustomerSupportFeature = createFeatureSelector(
- customerSupportFeatureKey
-);
-
-//Return name from feature
-export const selectName = createSelector(
- selectCustomerSupportFeature,
- (state: State) => state.name
+ customerSupportFeatureKey,
);
-export interface CustomerSupportViewModel {
+export interface CusSupportData {
name: string;
isSentSuccess: boolean;
}
-export const selectCustomerSupportModel = createSelector(
+// export const selectName = createSelector(
+// selectCustomerSupportFeature,
+// (state: State) => state.name
+// );
+
+export const customerSupportData = createSelector(
selectCustomerSupportFeature,
- (state: State): CustomerSupportViewModel => {
+ (state: State): CusSupportData => {
return {
name: state.name,
isSentSuccess: state.isSentSuccess,