You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

33 lines
1.0 KiB

import { toast } from "react-toastify";
const initialState = {
loading: false,
error: null,
info: null,
list: null,
lastAdd: null,
};
export default function examQuestion(state = initialState, action) {
let { type, data } = action;
switch (type) {
case "examQuestion/info":
return { ...state, loading: false, info: data, error: null };
case "examQuestion/add":
// toast.success("درخواست با موفقیت انجام شد");
return { ...state, loading: false, error: null, lastAdd: data };
case "examQuestion/noteQuestion/add":
// toast.success("درخواست با موفقیت انجام شد");
return { ...state, loading: false, error: null, lastAdd: data };
case "examQuestion/list":
return { ...state, loading: false, error: null, list: data };
case "examQuestion/loading":
return { ...state, loading: true };
case "examQuestion/error":
toast.error(data.message);
return { ...state, loading: false, error: data.message };
default:
return state;
}
}