aboutsummaryrefslogtreecommitdiff
path: root/src/store/reports.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/store/reports.js')
-rw-r--r--src/store/reports.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/store/reports.js b/src/store/reports.js
new file mode 100644
index 00000000..d0c1f6dd
--- /dev/null
+++ b/src/store/reports.js
@@ -0,0 +1,29 @@
+import { createSlice } from '@reduxjs/toolkit';
+import dayjs from 'dayjs';
+
+const { reducer, actions } = createSlice({
+ name: 'reports',
+ initialState: {
+ groupIds: [],
+ period: 'today',
+ from: dayjs().subtract(1, 'hour').locale('en').format('YYYY-MM-DDTHH:mm'),
+ to: dayjs().locale('en').format('YYYY-MM-DDTHH:mm'),
+ },
+ reducers: {
+ updateGroupIds(state, action) {
+ state.groupIds = action.payload;
+ },
+ updatePeriod(state, action) {
+ state.period = action.payload;
+ },
+ updateFrom(state, action) {
+ state.from = action.payload;
+ },
+ updateTo(state, action) {
+ state.to = action.payload;
+ },
+ },
+});
+
+export { actions as reportsActions };
+export { reducer as reportsReducer };