From b61b3516f590597d4ca0bf4d5f72e7c0d52946e3 Mon Sep 17 00:00:00 2001 From: Vignesh Date: Tue, 11 Jan 2022 22:19:12 +0530 Subject: [PATCH 1/3] settings changes --- .vscode/settings.json | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index ad62e6f..b56c299 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,6 @@ { - "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 + "debug.console.fontSize": 14, + "markdown.preview.fontSize": 14, + "terminal.integrated.fontSize": 14, + "editor.fontSize": 13 +} From 5a02b592d58fc820007452214e273c5f3f17a50f Mon Sep 17 00:00:00 2001 From: Vignesh Date: Tue, 11 Jan 2022 23:24:49 +0530 Subject: [PATCH 2/3] fixes --- .../customer-support.component.html | 87 ++++++++++--------- .../customer-support.component.ts | 28 ++++-- .../store/actions/customer-support.actions.ts | 7 ++ src/app/store/index.ts | 11 +-- .../reducers/customer-support.reducer.ts | 25 ++++++ .../selectors/customer-support.selectors.ts | 11 +++ 6 files changed, 112 insertions(+), 57 deletions(-) create mode 100644 src/app/store/actions/customer-support.actions.ts create mode 100644 src/app/store/reducers/customer-support.reducer.ts create mode 100644 src/app/store/selectors/customer-support.selectors.ts diff --git a/src/app/pages/customer-support/customer-support.component.html b/src/app/pages/customer-support/customer-support.component.html index 4d8ea10..4a11103 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!

-
-
-
-
-
-
+
+
+
+
+

We are here to help!

+
+
+
+
+
+ -
-
- - -
-
- - -
-
-
- - -
- -
- - We got your message! We will be in touch. -
-
- - Oh snap! Unable to send message. Please contact us at our customer support line at 123-456-7890. -
-
+
+
+ + +
+
+ + +
+
+
+ + +
+ +
+ + We got your message! {{name$ | async }} We will be in touch. +
+
+ + Oh snap! Unable to send message. Please contact us at our customer support line at + 123-456-7890. +
+
-
- -
+
+ +
- -
-
-
\ No newline at end of file + +
+
+ diff --git a/src/app/pages/customer-support/customer-support.component.ts b/src/app/pages/customer-support/customer-support.component.ts index f342a78..1612fc3 100644 --- a/src/app/pages/customer-support/customer-support.component.ts +++ b/src/app/pages/customer-support/customer-support.component.ts @@ -1,7 +1,11 @@ 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 { CustomerSupportService } from 'src/app/shared/services/customer-support.service'; +import { sendCustomerSupportMessage } from 'src/app/store/actions/customer-support.actions'; +import { selectName } from 'src/app/store/selectors/customer-support.selectors'; +import { AppState } from './../../store/index'; @Component({ selector: 'app-customer-support', @@ -9,17 +13,27 @@ import { Observable } from 'rxjs'; styleUrls: ['./customer-support.component.scss'], }) export class CustomerSupportComponent implements OnInit { - constructor(private customerSupportService: CustomerSupportService) {} + constructor( + private customerSupportService: CustomerSupportService, + private store: Store + ) { } isSendSuccess: boolean | null = null; - ngOnInit(): void {} + name$: Observable; + + ngOnInit(): void { + + this.name$ = this.store.pipe(select(selectName)); + + } onSubmit(f: NgForm) { - this.customerSupportService.sendMessage(f.value).subscribe((success) => { - console.log(success); - this.isSendSuccess = success; - }); + // this.customerSupportService.sendMessage(f.value).subscribe((success) => { + // console.log(success); + // this.isSendSuccess = success; + // }); + this.store.dispatch(sendCustomerSupportMessage({ data: f.value })); } clearFeedback() { diff --git a/src/app/store/actions/customer-support.actions.ts b/src/app/store/actions/customer-support.actions.ts new file mode 100644 index 0000000..a616453 --- /dev/null +++ b/src/app/store/actions/customer-support.actions.ts @@ -0,0 +1,7 @@ +import { CustomerMessage } from 'src/app/shared/models/customer-message'; +import { createAction, props } from '@ngrx/store'; + +export const sendCustomerSupportMessage = createAction( + '[Customer Support Component] Sending Customer Support Message', + props<{ data: CustomerMessage }>() +); diff --git a/src/app/store/index.ts b/src/app/store/index.ts index bb7f2c7..0e95ba6 100644 --- a/src/app/store/index.ts +++ b/src/app/store/index.ts @@ -1,19 +1,16 @@ import { - ActionReducer, - ActionReducerMap, - createFeatureSelector, - createSelector, - MetaReducer + ActionReducerMap, MetaReducer } from '@ngrx/store'; import { environment } from '../../environments/environment'; +import * as fromCustomerSupport from './reducers/customer-support.reducer'; export interface AppState { - + [fromCustomerSupport.customerSupportFeatureKey]: fromCustomerSupport.State; } export const reducers: ActionReducerMap = { - + [fromCustomerSupport.customerSupportFeatureKey]: fromCustomerSupport.reducer, }; diff --git a/src/app/store/reducers/customer-support.reducer.ts b/src/app/store/reducers/customer-support.reducer.ts new file mode 100644 index 0000000..054a299 --- /dev/null +++ b/src/app/store/reducers/customer-support.reducer.ts @@ -0,0 +1,25 @@ +import { createReducer, on } from '@ngrx/store'; +import { sendCustomerSupportMessage } from '../actions/customer-support.actions'; + + +export const customerSupportFeatureKey = 'customerSupport'; + +export interface State { + name: string; +} + +export const initialState: State = { + name: null +}; + + +export const reducer = createReducer( + initialState, + on(sendCustomerSupportMessage, (state, action) => { + return { + ...state, + name: action.data.name, + }; + }) +); + diff --git a/src/app/store/selectors/customer-support.selectors.ts b/src/app/store/selectors/customer-support.selectors.ts new file mode 100644 index 0000000..c3bb069 --- /dev/null +++ b/src/app/store/selectors/customer-support.selectors.ts @@ -0,0 +1,11 @@ +import { createFeatureSelector, createSelector } from '@ngrx/store'; +import { customerSupportFeatureKey, State } from '../reducers/customer-support.reducer'; + +export const selectCustomerSupportFeature = createFeatureSelector( + customerSupportFeatureKey, +); + +export const selectName = createSelector( + selectCustomerSupportFeature, + (state: State) => state.name +); From 89dceaf516a3b9a92e5085f3e17c3b83859d41ee Mon Sep 17 00:00:00 2001 From: Vignesh Date: Wed, 12 Jan 2022 09:04:34 +0530 Subject: [PATCH 3/3] upto auth feature --- .vscode/settings.json | 4 +-- package-lock.json | 13 +++++++- package.json | 8 +++-- src/app/app.module.ts | 5 +++- src/app/modules/auth/auth.module.ts | 12 ++++++-- .../customer-support.component.html | 10 +++---- .../customer-support.component.spec.ts | 25 ---------------- .../customer-support.component.ts | 21 +++++-------- .../services/customer-support.service.ts | 3 +- src/app/store/actions/auth.actions.ts | 15 ++++++++++ .../store/actions/customer-support.actions.ts | 9 ++++++ src/app/store/effects/auth.effects.ts | 30 +++++++++++++++++++ .../store/effects/customer-support.effects.ts | 23 ++++++++++++++ src/app/store/index.ts | 5 +++- src/app/store/reducers/auth.reducer.ts | 21 +++++++++++++ .../reducers/customer-support.reducer.ts | 22 ++++++++++++-- src/app/store/selectors/auth.selectors.ts | 6 ++++ .../selectors/customer-support.selectors.ts | 19 ++++++++++-- 18 files changed, 191 insertions(+), 60 deletions(-) delete mode 100644 src/app/pages/customer-support/customer-support.component.spec.ts create mode 100644 src/app/store/actions/auth.actions.ts create mode 100644 src/app/store/effects/auth.effects.ts create mode 100644 src/app/store/effects/customer-support.effects.ts create mode 100644 src/app/store/reducers/auth.reducer.ts create mode 100644 src/app/store/selectors/auth.selectors.ts diff --git a/.vscode/settings.json b/.vscode/settings.json index 505f2bf..9f7e852 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { - "window.zoomLevel": 1, + "window.zoomLevel": 0.5, "debug.console.fontSize": 14.1, "markdown.preview.fontSize": 14.1, "terminal.integrated.fontSize": 14.1, "editor.fontSize": 14.1 -} \ No newline at end of file +} diff --git a/package-lock.json b/package-lock.json index fe8ac95..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, @@ -1507,6 +1507,17 @@ } } }, + "@ngrx/effects": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/@ngrx/effects/-/effects-9.2.1.tgz", + "integrity": "sha512-qWOnRYHdKzjCvcH6WOKra+KPlrMyS9ahoVvOSboJK7S3xzj9Pp5mgtcDBXqN9LlPbXDEzjZjFDJQMAtlP4c3Ig==" + }, + "@ngrx/schematics": { + "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", "resolved": "https://registry.npmjs.org/@ngrx/store/-/store-9.2.0.tgz", diff --git a/package.json b/package.json index ddbae50..026c680 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "NGRX-Course", + "name": "ngrx", "version": "0.0.0", "scripts": { "ng": "ng", @@ -35,16 +35,18 @@ "tslib": "^1.10.0", "zone.js": "~0.10.2", "@ngrx/store": "^9.0.0", - "@ngrx/store-devtools": "^9.0.0" + "@ngrx/store-devtools": "^9.0.0", + "@ngrx/effects": "^9.0.0" }, "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 25fd04e..9c8fe0b 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -22,6 +22,8 @@ import { StoreModule } from '@ngrx/store'; import { StoreDevtoolsModule } from '@ngrx/store-devtools'; import { environment } from '../environments/environment'; import { reducers, metaReducers } from './store'; +import { EffectsModule } from '@ngrx/effects'; +import { CustomerSupportEffects } from './store/effects/customer-support.effects'; @NgModule({ declarations: [ @@ -57,8 +59,9 @@ import { reducers, metaReducers } from './store'; }, }), !environment.production ? StoreDevtoolsModule.instrument() : [], + 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 f56b07f..9843e97 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'; @@ -8,7 +12,11 @@ import { AuthLinksComponent } from './auth-links/auth-links.component'; @NgModule({ declarations: [LoginComponent, AuthLinksComponent], - imports: [CommonModule, AuthRoutingModule, FormsModule], + 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 4a11103..ec7227d 100644 --- a/src/app/pages/customer-support/customer-support.component.html +++ b/src/app/pages/customer-support/customer-support.component.html @@ -1,4 +1,4 @@ -
+

Customer Support

@@ -27,12 +27,12 @@

We are here to help!

- -
+ +
- We got your message! {{name$ | async }} We will be in touch. + We got your message! {{cusData?.name}} We will be in touch.
-
+
Oh snap! Unable to send message. Please contact us at our customer support line at 123-456-7890. 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 1612fc3..922891c 100644 --- a/src/app/pages/customer-support/customer-support.component.ts +++ b/src/app/pages/customer-support/customer-support.component.ts @@ -3,9 +3,10 @@ import { NgForm } from '@angular/forms'; import { select, Store } from '@ngrx/store'; import { Observable } from 'rxjs'; import { CustomerSupportService } from 'src/app/shared/services/customer-support.service'; -import { sendCustomerSupportMessage } from 'src/app/store/actions/customer-support.actions'; -import { selectName } from 'src/app/store/selectors/customer-support.selectors'; +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', @@ -14,29 +15,23 @@ import { AppState } from './../../store/index'; }) export class CustomerSupportComponent implements OnInit { constructor( - private customerSupportService: CustomerSupportService, private store: Store ) { } isSendSuccess: boolean | null = null; - name$: Observable; + cusData$: Observable; ngOnInit(): void { - - this.name$ = this.store.pipe(select(selectName)); - + this.cusData$ = this.store.pipe(select(CustomerSelectors.customerSupportData)); } onSubmit(f: NgForm) { - // this.customerSupportService.sendMessage(f.value).subscribe((success) => { - // console.log(success); - // this.isSendSuccess = success; - // }); - this.store.dispatch(sendCustomerSupportMessage({ data: f.value })); + this.store.dispatch(FromCustomerActions.sendCustomerSupportMessage({ data: f.value })); + this.isSendSuccess = true; } clearFeedback() { - this.isSendSuccess = null; + 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 new file mode 100644 index 0000000..103d434 --- /dev/null +++ b/src/app/store/actions/auth.actions.ts @@ -0,0 +1,15 @@ +import { createAction, props } from '@ngrx/store'; + +export const loadAuths = createAction( + '[Auth] Load Auths' +); + +export const loadAuthsSuccess = createAction( + '[Auth] Load Auths Success', + props<{ data: any }>() +); + +export const loadAuthsFailure = createAction( + '[Auth] Load Auths Failure', + props<{ error: any }>() +); diff --git a/src/app/store/actions/customer-support.actions.ts b/src/app/store/actions/customer-support.actions.ts index a616453..f057b7b 100644 --- a/src/app/store/actions/customer-support.actions.ts +++ b/src/app/store/actions/customer-support.actions.ts @@ -5,3 +5,12 @@ export const sendCustomerSupportMessage = createAction( '[Customer Support Component] Sending Customer Support Message', props<{ data: CustomerMessage }>() ); + +export const sendCustomerSupportStatus = createAction( + '[Customer Support Effect] Sending Customer Support Status', + props<{ isSentSuccess: boolean }>() +); + +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 new file mode 100644 index 0000000..310bd7a --- /dev/null +++ b/src/app/store/effects/auth.effects.ts @@ -0,0 +1,30 @@ +import { Injectable } from '@angular/core'; +import { Actions, createEffect, ofType } from '@ngrx/effects'; +import { catchError, map, concatMap } from 'rxjs/operators'; +import { Observable, EMPTY, of } from 'rxjs'; + +import * as AuthActions from '../actions/auth.actions'; + + + +@Injectable() +export class AuthEffects { + + loadAuths$ = createEffect(() => { + return this.actions$.pipe( + + 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) {} + +} diff --git a/src/app/store/effects/customer-support.effects.ts b/src/app/store/effects/customer-support.effects.ts new file mode 100644 index 0000000..7951390 --- /dev/null +++ b/src/app/store/effects/customer-support.effects.ts @@ -0,0 +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'; +// tslint:disable-next-line: import-spacing +import * as FromCustomerActions from '../actions/customer-support.actions'; + +@Injectable() +export class CustomerSupportEffects { + + effectName$ = createEffect(() => { + return this.actions$.pipe( + ofType(FromCustomerActions.sendCustomerSupportMessage), + mergeMap((action) => + this.customerService.sendMessage(action.data).pipe( + map(msgSts => FromCustomerActions.sendCustomerSupportStatus({ isSentSuccess: msgSts })) + ) + ), + ); + }); + + constructor(private actions$: Actions, private customerService: CustomerSupportService) { } +} diff --git a/src/app/store/index.ts b/src/app/store/index.ts index 0e95ba6..985cd2f 100644 --- a/src/app/store/index.ts +++ b/src/app/store/index.ts @@ -1,16 +1,19 @@ import { - ActionReducerMap, MetaReducer + 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 interface AppState { [fromCustomerSupport.customerSupportFeatureKey]: fromCustomerSupport.State; + [fromAuth.authFeatureKey]: fromAuth.State; } export const reducers: ActionReducerMap = { [fromCustomerSupport.customerSupportFeatureKey]: fromCustomerSupport.reducer, + [fromAuth.authFeatureKey]: fromAuth.reducer, }; diff --git a/src/app/store/reducers/auth.reducer.ts b/src/app/store/reducers/auth.reducer.ts new file mode 100644 index 0000000..8e09a1d --- /dev/null +++ b/src/app/store/reducers/auth.reducer.ts @@ -0,0 +1,21 @@ +import { Action, createReducer, on } from '@ngrx/store'; +import * as AuthActions from '../actions/auth.actions'; + +export const authFeatureKey = 'auth'; + +export interface State { + +} + +export const initialState: State = { + +}; + +export const reducer = createReducer( + initialState, + + 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 054a299..2500fa1 100644 --- a/src/app/store/reducers/customer-support.reducer.ts +++ b/src/app/store/reducers/customer-support.reducer.ts @@ -1,25 +1,41 @@ import { createReducer, on } from '@ngrx/store'; -import { sendCustomerSupportMessage } from '../actions/customer-support.actions'; +// tslint:disable-next-line: import-spacing +import * as FromCustomerActions from '../actions/customer-support.actions'; export const customerSupportFeatureKey = 'customerSupport'; export interface State { name: string; + isSentSuccess: boolean | null; } export const initialState: State = { - name: null + name: null, + isSentSuccess: null, }; export const reducer = createReducer( initialState, - on(sendCustomerSupportMessage, (state, action) => { + on(FromCustomerActions.sendCustomerSupportMessage, (state, action) => { return { ...state, name: action.data.name, }; + }), + on(FromCustomerActions.sendCustomerSupportStatus, (state, action) => { + return { + ...state, + isSentSuccess: action.isSentSuccess, + }; + }), + on(FromCustomerActions.clearCustomerSupportStatus, (state) => { + return { + ...state, + name: null, + isSentSuccess: null, + }; }) ); diff --git a/src/app/store/selectors/auth.selectors.ts b/src/app/store/selectors/auth.selectors.ts new file mode 100644 index 0000000..d0238e1 --- /dev/null +++ b/src/app/store/selectors/auth.selectors.ts @@ -0,0 +1,6 @@ +import { createFeatureSelector, createSelector } from '@ngrx/store'; +import * as fromAuth from '../reducers/auth.reducer'; + +export const selectAuthState = createFeatureSelector( + fromAuth.authFeatureKey +); diff --git a/src/app/store/selectors/customer-support.selectors.ts b/src/app/store/selectors/customer-support.selectors.ts index c3bb069..11a4a33 100644 --- a/src/app/store/selectors/customer-support.selectors.ts +++ b/src/app/store/selectors/customer-support.selectors.ts @@ -5,7 +5,22 @@ export const selectCustomerSupportFeature = createFeatureSelector( customerSupportFeatureKey, ); -export const selectName = createSelector( +export interface CusSupportData { + name: string; + isSentSuccess: boolean; +} + +// export const selectName = createSelector( +// selectCustomerSupportFeature, +// (state: State) => state.name +// ); + +export const customerSupportData = createSelector( selectCustomerSupportFeature, - (state: State) => state.name + (state: State): CusSupportData => { + return { + name: state.name, + isSentSuccess: state.isSentSuccess, + }; + } );