I've just started learning redux-observables and RxJS for work recently. We have alerts globally set in Redux. I want to be able to set an alert, then after a set period, close that same alert. There can also be multiple alerts at any time, and the user could manually close one alert before it automatically closes itself. I have added to id here, so I can close the correct alert. I have attempted to use delay after the initial map than another map to achieve this so far. However, this skips the first map.
export const addAlertEpic: Epic<Action, Action, RootState> = (
action$,
state$
) =>
action$.pipe(
ofType(slice.actions.addAlert),
map((values: any) =>
slice.actions.addAlertSuccess({ id: uuid(), ...values.payload })
)
);
Thank you for help!