score:0

import { from } from 'rxjs';
import { catchError } from 'rxjs/operators';

...

return action$.pipe(
    ofType('UPDATE_TRIP_DETAILS'),
    mergeMap((action) => {
        const userId = store.value.user.id
        const { country, newDetails } = action
        const { people, places } = details
        const scheme = {
            people,
            places,
        }

        return from(firebase.database().ref(`users/${userId}/path`).update(scheme))
            .pipe(
                // `mergeMap` will handle only `next` notifications
                mergeMap((response) => {
                    const payload = ...
                    return [updatedCountrySuccess(payload)]
                }),
                catchError(error => of(errorAction)),
            );
    }),
)

Related Query

More Query from same tag