32 lines
708 B
JavaScript
32 lines
708 B
JavaScript
|
|
import { createSlice } from "@reduxjs/toolkit";
|
||
|
|
|
||
|
|
const initialState = {
|
||
|
|
file: null,
|
||
|
|
result: null,
|
||
|
|
validatedData: null,
|
||
|
|
};
|
||
|
|
|
||
|
|
const uploadSlice = createSlice({
|
||
|
|
name: "upload",
|
||
|
|
initialState,
|
||
|
|
reducers: {
|
||
|
|
setFile: (state, action) => {
|
||
|
|
state.file = action.payload;
|
||
|
|
},
|
||
|
|
setResult: (state, action) => {
|
||
|
|
state.result = action.payload;
|
||
|
|
},
|
||
|
|
setValidatedData: (state, action) => {
|
||
|
|
state.validatedData = action.payload;
|
||
|
|
},
|
||
|
|
reset: (state) => {
|
||
|
|
state.file = null;
|
||
|
|
state.result = null;
|
||
|
|
state.validatedData = null;
|
||
|
|
},
|
||
|
|
},
|
||
|
|
});
|
||
|
|
|
||
|
|
export const { setFile, setResult, setValidatedData, reset } = uploadSlice.actions;
|
||
|
|
export default uploadSlice.reducer;
|