This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const startLoggingServiceEpic = ( | |
| action$, | |
| ) => ( | |
| action$ | |
| .pipe( | |
| ofType(UPDATE_USER_INFO), | |
| map(({ | |
| email, | |
| phone, | |
| userName, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const startChatSystemEpic = ( | |
| action$, | |
| ) => ( | |
| action$ | |
| .pipe( | |
| ofType(START_CHAT_CLIENT), | |
| take(1) | |
| tap(startChatClient), | |
| ignoreElements(), | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const listenForChatMessageEpic = ( | |
| action$, | |
| ) => ( | |
| action$ | |
| .pipe( | |
| ofType(START_CHAT_CLIENT), | |
| tap(startChatClient), | |
| takeUntil( | |
| action$ | |
| .pipe( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Redux-Observable 1.x.x | |
| const logAppVersionEpic = () => ( | |
| of(appVersion) | |
| .pipe( | |
| tap(console.info), | |
| ignoreElements(), | |
| ) | |
| ) | |
| // Another Option for Redux-Observable 1.x.x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const storeUserInfoEpic = ( | |
| action$, | |
| ) => ( | |
| action$ | |
| .pipe( | |
| ofType(UPDATE_USER_INFO), | |
| map(({ | |
| authInfo, | |
| userInfo, | |
| }) => ({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const reduxObservableMiddleware = ( | |
| store => { | |
| const reduxObservable$ = ( | |
| new Subject() | |
| ) | |
| reduxObservable$ | |
| .subscribe(store.dispatch) | |
| return ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const timer = ( | |
| timeToWait, | |
| ) => ( | |
| Observable | |
| .create(observer => ( | |
| setTimeout( | |
| () => { | |
| observer.next(0) | |
| observer.complete() | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const initialState = {} | |
| const reducerActions = { | |
| [STORE_USER_INFO]: ( | |
| (prevState, { data }) => ( | |
| data | |
| || initialState | |
| ) | |
| ), | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const hideLoginModalEpic = ( | |
| action$, | |
| state$, | |
| ) => ( | |
| action$ | |
| .pipe( | |
| ofType(UPDATE_AUTH_INFO), | |
| map(() => ( | |
| state$ | |
| .value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const hideLoginModalEpic = ( | |
| action$, | |
| state$, | |
| ) => ( | |
| state$ | |
| .pipe( | |
| map(authInfoSelector), | |
| pluck('isAuthenticated'), | |
| distinctUntilChanged(), | |
| filter(Boolean), |