aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/lib/getHistory.js
blob: 642a9a8285e9f5f62d34a3a8a61679588ea2e646 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import {
  makeSetUser,
  makeSetWeek,
  weekFromLocation,
  userFromLocation,
} from './url';

export default function makeGetHistory(history) {
  return function getHistory() {
    const user = userFromLocation(history.location);
    const week = weekFromLocation(history.location);
    const setUser = makeSetUser(history);
    const setWeek = makeSetWeek(history);

    return {
      user,
      week,
      setUser,
      setWeek,
    };
  };
}