I’m using event bus with mitt
library and I want to listen to logout
even and when it occurs, call:
useEventBus('logout', () => {
router.replace('/');
toast({ variant: 'success', title: 'Wylogowano!' });
setIsLoggingOut(false);
});
where setIsLoggingOut
sets a global variable in my axios interceptor. I want to call setIsLoggingOut
once router.replace()
completes and not as it is done now. How can I do that?