aboutsummaryrefslogtreecommitdiff
path: root/modern/src/admin/StatisticsPage.js
diff options
context:
space:
mode:
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());
}