guild_front/src/redux/reportSlice.js

52 lines
1.2 KiB
JavaScript

import { createSlice } from "@reduxjs/toolkit";
const initialState = {
dateSelected: "",
reportDate: "",
requestDates: "",
sendRequest: "",
editReport: ""
};
export const reportSlice = createSlice({
name: "report",
initialState,
reducers: {
dateSelected: (state, action) => {
state.dateSelected = action.payload;
},
setReportDate: (state, action) => {
state.reportDate = action.payload;
},
setRequestDate: (state, action) => {
state.requestDates = action.payload;
},
setSendRequest: (state, action) => {
state.sendRequest = action.payload;
},
setEditReport: (state, action) => {
state.editReport = action.payload;
}
}
});
export const {
dateSelected,
setReportDate,
setRequestDate,
setSendRequest,
setEditReport
} = reportSlice.actions;
export const selectDate = (state) => state.report.dateSelected;
export const getReportDate = (state) => state.report.reportDate;
export const getRequestDates = (state) => state.report.requestDates;
export const getSendRequest = (state) => state.report.sendRequest;
export const getEditReport = (state) => state.report.editReport;
export default reportSlice.reducer;