aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/store/actions.js
blob: c4cc9badfaff5262b0bec18b8702bea949e9866c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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' });
  };
}