0

For example:

export const authMiddleWare = createListenerMiddleware<TRootState>();

const startAuthMiddleWare = authMiddleWare.startListening as TListener;

startAuthMiddleWare({
    actionCreator: actionSetToken,
    effect: (_, {dispatch, getState}) => {
        favoriteProductsLoggedInEffect(dispatch, getState);
        cartLoggedInEffect(dispatch, getState);
    },
});

startAuthMiddleWare({
    actionCreator: actionFlushToken,
    effect: () => {
        AuthService.flushTokens();
    },
});

First I'm subscribe to actionSetToken and after that I've subscribe to actionFlushToken trough single startAuthMiddleWare method. Is it safe? Can I override the actionSetToken-subscrib by subscribing to actionSetFlushToken?

Evgeniy
  • 303
  • 2
  • 9

0 Answers0