rxjs/operators#exhaustMap TypeScript Examples
The following examples show how to use
rxjs/operators#exhaustMap.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: auth.effects.ts From router with MIT License | 6 votes |
login$ = createEffect(() =>
this.actions$.pipe(
ofType(LoginPageActions.login),
map((action) => action.credentials),
exhaustMap((auth: Credentials) =>
this.authService.login(auth).pipe(
map((user) => AuthApiActions.loginSuccess({ user })),
catchError((error) => of(AuthApiActions.loginFailure({ error })))
)
)
)
);
Example #2
Source File: auth.effects.ts From router with MIT License | 6 votes |
logoutConfirmation$ = createEffect(() =>
this.actions$.pipe(
ofType(AuthActions.logoutConfirmation),
exhaustMap(() => {
const dialogRef = this.dialog.open<
LogoutConfirmationDialogComponent,
undefined,
boolean
>(LogoutConfirmationDialogComponent);
return dialogRef.afterClosed();
}),
map((result) =>
result ? AuthActions.logout() : AuthActions.logoutConfirmationDismiss()
)
)
);
Example #3
Source File: settings.effects.ts From dating-client with MIT License | 6 votes |
EditUserProfile$ = createEffect(() => this.actions$.pipe(
ofType(SettingsActions.editUserSettings),
concatLatestFrom(() => this.store.select(selectUserProfileSettings)),
exhaustMap(([{ userData }, userProfile]) => {
const payload: User = { ...userProfile, ...userData };
return this.memberService.editMember(payload).pipe(
map(user => {
this.toast.success('Profile was successfully updated!');
return SettingsActions.editUserSettingsSuccess({ user });
}),
catchError(error => {
this.toast.error(error);
return of(SettingsActions.editUserSettingsFailure({ error }));
}),
);
})
));
Example #4
Source File: pan.ts From ble with Apache License 2.0 | 6 votes |
panShortcut: Epic = (action$, { store }) => {
return fromEvent<KeyboardEvent>(document, 'keydown').pipe(
filter((ev) => ev.key === ' '),
map(() => store.editor.mode),
tap(() => {
store.editor.setMode(EditorMode.pan);
}),
exhaustMap((oldMode) => fromEvent<KeyboardEvent>(document, 'keyup').pipe(
take(1),
tap(() => {
store.editor.setMode(oldMode);
}),
)),
);
}
Example #5
Source File: current-user.effects.ts From taiga-front-next with GNU Affero General Public License v3.0 | 6 votes |
loadCurrentUser$ = createEffect(() => {
return this.actions$.pipe(
ofType(CurrentUserActions.loadCurrentUser),
exhaustMap(() =>
this.currentUserApiService
.getCurrentUser()
.pipe(
map(data => CurrentUserActions.loadCurrentUserSuccess({ data })),
catchError(({ error }) => of(CurrentUserActions.loadCurrentUserFailure({ error })))
)
)
);
});
Example #6
Source File: login.effects.ts From taiga-front-next with GNU Affero General Public License v3.0 | 6 votes |
login$ = createEffect(() => {
return this.actions$.pipe(
ofType(LoginActions.login),
exhaustMap((action) => {
return this.authApiService.login({
...action.data,
type: 'normal',
}).pipe(
map(data => LoginActions.loginSuccess({ data })),
catchError(({ error }) => of(LoginActions.loginFailure({ error })))
);
})
);
});