refactor(nx): simplify DataPersistence methods
This commit is contained in:
parent
2fc57955cd
commit
d38700ead7
@ -237,9 +237,9 @@ export class DataPersistence<T> {
|
|||||||
actionType: string,
|
actionType: string,
|
||||||
opts: PessimisticUpdateOpts<T, A>
|
opts: PessimisticUpdateOpts<T, A>
|
||||||
): Observable<any> {
|
): Observable<any> {
|
||||||
const nav = this.actions.ofType<A>(actionType);
|
return this.actions
|
||||||
const pairs = nav.pipe(withLatestFrom(this.store));
|
.ofType<A>(actionType)
|
||||||
return pairs.pipe(pessimisticUpdate(opts));
|
.pipe(withLatestFrom(this.store), pessimisticUpdate(opts));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -292,9 +292,9 @@ export class DataPersistence<T> {
|
|||||||
actionType: string,
|
actionType: string,
|
||||||
opts: OptimisticUpdateOpts<T, A>
|
opts: OptimisticUpdateOpts<T, A>
|
||||||
): Observable<any> {
|
): Observable<any> {
|
||||||
const nav = this.actions.ofType<A>(actionType);
|
return this.actions
|
||||||
const pairs = nav.pipe(withLatestFrom(this.store));
|
.ofType<A>(actionType)
|
||||||
return pairs.pipe(optimisticUpdate(opts));
|
.pipe(withLatestFrom(this.store), optimisticUpdate(opts));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -368,10 +368,9 @@ export class DataPersistence<T> {
|
|||||||
actionType: string,
|
actionType: string,
|
||||||
opts: FetchOpts<T, A>
|
opts: FetchOpts<T, A>
|
||||||
): Observable<any> {
|
): Observable<any> {
|
||||||
const nav = this.actions.ofType<A>(actionType);
|
return this.actions
|
||||||
const allPairs = nav.pipe(withLatestFrom(this.store));
|
.ofType<A>(actionType)
|
||||||
|
.pipe(withLatestFrom(this.store), fetch(opts));
|
||||||
return allPairs.pipe(fetch(opts));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -411,9 +410,10 @@ export class DataPersistence<T> {
|
|||||||
component: Type<any>,
|
component: Type<any>,
|
||||||
opts: HandleNavigationOpts<T>
|
opts: HandleNavigationOpts<T>
|
||||||
): Observable<any> {
|
): Observable<any> {
|
||||||
const nav = this.actions;
|
return this.actions.pipe(
|
||||||
const pairs = nav.pipe(withLatestFrom(this.store));
|
withLatestFrom(this.store),
|
||||||
return pairs.pipe(navigation(component, opts));
|
navigation(component, opts)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user