Huthaifa-Dev / project

Either all code paths should have explicit returns, or none of them JS-0045
Anti-pattern
Minor
a month ago9 months old
Expected to return a value at the end of arrow function
 50}) => {
 51  const categories = useSelector(selectCategories);
 52  const products = useSelector(selectProducts);
 53  const product = useSelector((state: RootState) => { 54    if (DELETE) {
 55      return selectProductById(state, DELETE);
 56    }
Expected to return a value at the end of method 'validate'
 80              <input
 81                {...register("name", {
 82                  required: "Name is required",
 83                  validate: (data) => { 84                    if (data === "") {
 85                      return "Name is required";
 86                    } else if (
Expected to return a value at the end of async arrow function
 81);
 82export const addProductData = createAsyncThunk(
 83  "categories/addProductData",
 84  async (data: Partial<Product>) => { 85    try {
 86      const product = createProduct(data as Product);
 87      await axios.post(`${PRODUCTS_URL}` + ".json", product);
Expected to return a value at the end of async arrow function
 52);
 53export const editProductData = createAsyncThunk(
 54  "categories/editProduct",
 55  async (data: { id: string; newProduct: Partial<Product> }) => { 56    try {
 57      const product = await axios.get(`${PRODUCTS_URL}/${data.id}` + ".json");
 58      product.data = { ...data.newProduct };
Expected to return a value at the end of async arrow function
 39
 40export const deleteProduct = createAsyncThunk(
 41  "categories/deleteProduct",
 42  async (data: { body: string }) => { 43    try {
 44      const response = await axios.delete(
 45        `${PRODUCTS_URL}/${data.body}` + ".json"