feature-libs/asm/core/facade/asm.service.ts
Methods |
constructor(store: Store
|
||||||
|
Parameters :
|
| customerSearch | ||||||
customerSearch(options: CustomerSearchOptions)
|
||||||
|
Search for customers
Parameters :
Returns :
void
|
| customerSearchReset |
customerSearchReset()
|
|
Reset the customer search result data to the initial state.
Returns :
void
|
| getAsmUiState |
getAsmUiState()
|
|
Get the state of the ASM UI
Returns :
Observable<AsmUi>
|
| getCustomerSearchResults |
getCustomerSearchResults()
|
|
Returns the customer search result data.
Returns :
Observable<CustomerSearchPage>
|
| getCustomerSearchResultsLoading |
getCustomerSearchResultsLoading()
|
|
Returns the customer search result loading status.
Returns :
Observable<boolean>
|
| updateAsmUiState | ||||||
updateAsmUiState(asmUi: AsmUi)
|
||||||
|
Updates the state of the ASM UI
Parameters :
Returns :
void
|
import { Injectable } from '@angular/core';
import { select, Store } from '@ngrx/store';
import { Observable } from 'rxjs';
import {
AsmUi,
CustomerSearchOptions,
CustomerSearchPage,
} from '../models/asm.models';
import { AsmActions } from '../store/actions/index';
import { StateWithAsm } from '../store/asm-state';
import { AsmSelectors } from '../store/index';
@Injectable({
providedIn: 'root',
})
export class AsmService {
constructor(protected store: Store<StateWithAsm>) {}
/**
* Search for customers
* @param options
*/
customerSearch(options: CustomerSearchOptions): void {
this.store.dispatch(new AsmActions.CustomerSearch(options));
}
/**
* Reset the customer search result data to the initial state.
*/
customerSearchReset(): void {
this.store.dispatch(new AsmActions.CustomerSearchReset());
}
/**
* Returns the customer search result data.
*/
getCustomerSearchResults(): Observable<CustomerSearchPage> {
return this.store.pipe(select(AsmSelectors.getCustomerSearchResults));
}
/**
* Returns the customer search result loading status.
*/
getCustomerSearchResultsLoading(): Observable<boolean> {
return this.store.pipe(
select(AsmSelectors.getCustomerSearchResultsLoading)
);
}
/**
* Updates the state of the ASM UI
*/
updateAsmUiState(asmUi: AsmUi): void {
this.store.dispatch(new AsmActions.AsmUiUpdate(asmUi));
}
/**
* Get the state of the ASM UI
*/
getAsmUiState(): Observable<AsmUi> {
return this.store.pipe(select(AsmSelectors.getAsmUi));
}
}