mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
Set Search Input in Ngrx Store
This commit is contained in:
@@ -1,23 +1,31 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Store } from '@ngxs/store';
|
||||
import { Store as NgxsStore } from '@ngxs/store';
|
||||
import { SetShelfSearch } from 'apps/sales/src/app/core/store/actions/process.actions';
|
||||
import { ShelfSearch } from 'apps/sales/src/app/core/models/shelf-search.modal';
|
||||
import { BranchSelectors } from 'apps/sales/src/app/core/store/selectors/branch.selector';
|
||||
import { SearchStateFacade } from 'apps/sales/src/app/store/customer';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ShelfStoreFacadeService {
|
||||
constructor(private store: Store) {}
|
||||
constructor(
|
||||
private ngxsStore: NgxsStore,
|
||||
private storeFacade: SearchStateFacade
|
||||
) {}
|
||||
|
||||
get branchnumber(): string {
|
||||
return this.store.selectSnapshot(BranchSelectors.getUserBranch);
|
||||
return this.ngxsStore.selectSnapshot(BranchSelectors.getUserBranch);
|
||||
}
|
||||
|
||||
setShelfSearch(input: string) {
|
||||
this.store.dispatch(
|
||||
/** NGXXS Store */
|
||||
this.ngxsStore.dispatch(
|
||||
new SetShelfSearch(<ShelfSearch>{
|
||||
input,
|
||||
branchnumber: this.branchnumber,
|
||||
})
|
||||
);
|
||||
|
||||
/** NEW NgRx Store */
|
||||
this.storeFacade.setInput(input);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user