aboutsummaryrefslogtreecommitdiff
path: root/modern/src/admin/StatisticsPage.js
diff options
context:
space:
mode:
authorDesmond Kyeremeh <elDekyfin@gmail.com>2021-07-12 03:30:34 +0000
committerDesmond Kyeremeh <elDekyfin@gmail.com>2021-07-12 03:30:34 +0000
commitf60983a4131862db0125844a651b994d2212022d (patch)
treec44ef60f3c37dbfc286ff3f4111f10a08b7d7b4f /modern/src/admin/StatisticsPage.js
parenta7e1b5f5fd772d37f9777fec097f28411f13562f (diff)
downloadtrackermap-web-f60983a4131862db0125844a651b994d2212022d.tar.gz
trackermap-web-f60983a4131862db0125844a651b994d2212022d.tar.bz2
trackermap-web-f60983a4131862db0125844a651b994d2212022d.zip
Restored styling
Diffstat (limited to 'modern/src/admin/StatisticsPage.js')
-rw-r--r--modern/src/admin/StatisticsPage.js33
1 files changed, 8 insertions, 25 deletions
diff --git a/modern/src/admin/StatisticsPage.js b/modern/src/admin/StatisticsPage.js
index 20974f4d..1f32c3d9 100644
--- a/modern/src/admin/StatisticsPage.js
+++ b/modern/src/admin/StatisticsPage.js
@@ -21,36 +21,24 @@ const Filter = ({ setItems }) => {
selectedTo = moment().endOf('day');
break;
case 'yesterday':
- selectedFrom = moment()
- .subtract(1, 'day')
- .startOf('day');
- selectedTo = moment()
- .subtract(1, 'day')
- .endOf('day');
+ selectedFrom = moment().subtract(1, 'day').startOf('day');
+ selectedTo = moment().subtract(1, 'day').endOf('day');
break;
case 'thisWeek':
selectedFrom = moment().startOf('week');
selectedTo = moment().endOf('week');
break;
case 'previousWeek':
- selectedFrom = moment()
- .subtract(1, 'week')
- .startOf('week');
- selectedTo = moment()
- .subtract(1, 'week')
- .endOf('week');
+ selectedFrom = moment().subtract(1, 'week').startOf('week');
+ selectedTo = moment().subtract(1, 'week').endOf('week');
break;
case 'thisMonth':
selectedFrom = moment().startOf('month');
selectedTo = moment().endOf('month');
break;
case 'previousMonth':
- selectedFrom = moment()
- .subtract(1, 'month')
- .startOf('month');
- selectedTo = moment()
- .subtract(1, 'month')
- .endOf('month');
+ selectedFrom = moment().subtract(1, 'month').startOf('month');
+ selectedTo = moment().subtract(1, 'month').endOf('month');
break;
default:
selectedFrom = from;
@@ -58,13 +46,8 @@ const Filter = ({ setItems }) => {
break;
}
- const query = new URLSearchParams({
- from: selectedFrom.toISOString(),
- to: selectedTo.toISOString(),
- });
- const response = await fetch(`/api/statistics?${query.toString()}`, {
- Accept: 'application/json',
- });
+ const query = new URLSearchParams({ from: selectedFrom.toISOString(), to: selectedTo.toISOString() });
+ const response = await fetch(`/api/statistics?${query.toString()}`, { Accept: 'application/json' });
if (response.ok) {
setItems(await response.json());
}