blob: 3b7f6b47b806ab10eb8755c67f61336c58cedcdf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import moment from 'moment';
import queryString from 'query-string';
import users from '../users';
import purifyWeek from './purifyWeek';
export function userFromMatch(match) {
const user = `${match.params.type}/${match.params.value}`;
if (!users.allIds.includes(user)) {
return null;
}
return user;
}
export function weekFromLocation(location) {
const weekStr = queryString.parse(location.search).week;
if (!weekStr) {
return moment().week();
}
return purifyWeek(parseInt(weekStr, 10));
}
|