guild_front/src/redux/reportSlice.js

34 lines
824 B
JavaScript
Raw Normal View History

2021-12-07 10:58:19 +03:00
import { createSlice } from '@reduxjs/toolkit';
const initialState = {
dateSelected: '',
2023-02-09 20:46:02 +03:00
reportDate: '',
requestDates: ''
2021-12-07 10:58:19 +03:00
};
export const reportSlice = createSlice({
name: 'report',
initialState,
reducers: {
dateSelected: (state, action) => {
state.dateSelected = action.payload;
},
2022-12-26 15:12:01 +03:00
setReportDate: (state, action) => {
state.reportDate = action.payload;
},
2023-02-09 20:46:02 +03:00
setRequestDate: (state, action) => {
state.requestDates = action.payload
}
2021-12-07 10:58:19 +03:00
},
});
2023-02-09 20:46:02 +03:00
export const { dateSelected, setReportDate, setRequestDate} = reportSlice.actions;
2021-12-07 10:58:19 +03:00
export const selectDate = (state) => state.report.dateSelected;
2022-12-26 15:12:01 +03:00
export const getReportDate = (state) => state.report.reportDate;
2023-02-09 20:46:02 +03:00
export const getRequestDates = (state) => state.report.requestDates
2021-12-07 10:58:19 +03:00
export default reportSlice.reducer;