Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Time out logout
import { Observable } from 'rxjs';
export default function logOutEpic(actions, { getState }) {
return Observable
.interval(500)
.takeUntil(actions.ofType('LOG_OUT').first())
.map(() => {
const { app: { accessToken } = {} } = getState();
return accessToken;
})
.filter(Boolean)
.distinctUntilChanged()
.switchMap(() => {
return Observable.of({ type: 'LOG_OUT' }).delay(3000);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.