text: import {
    USER_REGISTER_FAIL,
    USER_REGISTER_REQUEST,
    USER_REGISTER_SUCCESS,
  } from "../constants/userConstants";
  import axios from "axios";
  
  export const register =
    (name, email, mobile_number, date_of_birth, gender, course_name, amount) =>
    async (dispatch) => {
      try {
        dispatch({ type: USER_REGISTER_REQUEST });
  
        const config = {
          headers: {
            "Content-type": "application/json",
          },
        };
  
        const { data } = await axios.post(
          "/api/register",
          {
            name,
            email,
            mobile_number,
            date_of_birth,
            gender,
            course_name,
            amount,
          },
          config
        );
  
        dispatch({ type: USER_REGISTER_SUCCESS, payload: data });
  
        // localStorage.setItem("userInfo", JSON.stringify(data));
      } catch (error) {
        console.log(error);
        dispatch({
          type: USER_REGISTER_FAIL,
          payload:
            error.response && error.response.data.message
              ? error.response.data.message
              : error.message,
        });
      }
    };
  