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

export default function makeGetHistory(history) {
  return function getHistory() {
    const user = userFromLocation(history.location);
    const week = weekFromLocation(history.location);
    const updatePathname = makeUpdatePathname(history);
    const updateQuery = makeUpdateQuery(history);

    return {
      user,
      week,
      updatePathname,
      updateQuery,
    };
  };
}