I have my auth function using rxjs epics:
export const authWithEmailPasswordEpic = action$ =>
action$.pipe(
filter(authUser.match),
switchMap(({payload}) =>
defer(() =>
from(firebaseEmailPasswordAuth(payload)).pipe(
mergeMap(() => of(clearAlertState(), stopLoading())),
catchError(err =>
of(clearState(), createAlert({
status: err.code,
alertType: RED_ALERT,
alertTitle: err.message
})),
)
)
)
)
);
If the users credentials are incorrect, I am dispatching an alert, but then I also want to remove the alert after 5 seconds or so. Therefore, I believe I'd need to emit two actions to achieve this, with the second one being:
of(toggleAlert()).pipe(delay(5000)))
How would I achieve this or is there a better way to do so?