diff options
Diffstat (limited to 'src/client/react/store/actions.js')
-rw-r--r-- | src/client/react/store/actions.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/client/react/store/actions.js b/src/client/react/store/actions.js new file mode 100644 index 0000000..c4cc9ba --- /dev/null +++ b/src/client/react/store/actions.js @@ -0,0 +1,14 @@ +import users from '../users'; + +export function showRoomFinder() { + return (dispatch, getState, getHistory) => { + const { user, setUser } = getHistory(); + + if (user == null || users.byId[user].type !== 'r') { + // We are not currently viewing a room, correct the situation. + setUser(users.allRoomIds[0]); + } + + dispatch({ type: 'ROOM_FINDER/SHOW' }); + }; +} |