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.
 
 
 

31 lines
948 B

import { toast } from "react-toastify";
const initialState = {
loading: false,
error: null,
listVOD: [],
selectedVOD: null,
similarList : [],
};
export default function product(state = initialState, action) {
let { type, data } = action;
switch (type) {
case "product/listVOD":
return { ...state, loading: false, listVOD: data, error: null };
case "product/similar":
return { ...state, loading: false, similarList: data, error: null };
case "product/addVOD":
return { ...state, loading: false, error: null };
case "product/deleteVOD":
return { ...state, loading: false, error: null };
case "product/selectVOD":
return { ...state, selectedVOD: data };
case "product/loading":
return { ...state, loading: true };
case "product/error":
toast.error(data.message);
return { ...state, loading: false, error: data.message };
default:
return state;
}
}