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.
 
 
 

24 lines
764 B

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