change 13 api forgot password render

This commit is contained in:
pawan-dot 2025-05-09 10:44:24 +05:30
parent f4c2383675
commit ad00bd4c2d
13 changed files with 102 additions and 114 deletions

View File

@ -19,8 +19,8 @@ const setupAxios = () => {
//Old render deploy
// axios.defaults.baseURL = "https://cheminova-api-2.onrender.com";
//latest render deploy
axios.defaults.baseURL = "https://cheminova-api1.onrender.com"
//axios.defaults.baseURL = "https://api.cnapp.co.in";
//axios.defaults.baseURL = "https://cheminova-api1.onrender.com"
axios.defaults.baseURL = "https://api.cnapp.co.in";
axios.defaults.headers = {
"Cache-Control": "no-cache,no-store",

View File

@ -44,7 +44,7 @@ const AddMultiplePd = () => {
formData.append("file", file);
const { data } = await axios.post(
"/api/v1/principaldistributor/upload",
"https://cheminova-api1.onrender.com/api/v1/principaldistributor/upload",
formData,
{
headers: {
@ -94,8 +94,7 @@ const AddMultiplePd = () => {
console.error("Upload error:", error);
swal(
"Error",
`Failed to upload Principal Distributor: ${
error.response?.data?.message || "An unexpected error occurred"
`Failed to upload Principal Distributor: ${error.response?.data?.message || "An unexpected error occurred"
}`,
"error"
);

View File

@ -121,7 +121,7 @@ const AddPrincipalDistributor = () => {
setLoading(true);
// Attempt to register user
const userResponse = await axios.post("/api/v1/user/register", {
const userResponse = await axios.post("https://cheminova-api1.onrender.com/api/v1/user/register", {
...user,
role: "principal-Distributor",
});

View File

@ -161,7 +161,7 @@ const principalDistributor = () => {
const handleReset = async (id) => {
try {
const response = await axios.put(
`/api/v1/user/reset-password/${id}`,
`https://cheminova-api1.onrender.com/api/v1/user/reset-password/${id}`,
{}, // No body content required for this request
{
headers: {
@ -587,8 +587,7 @@ const principalDistributor = () => {
<div className="dataTables_paginate paging_simple_numbers">
<ul className="pagination">
<li
className={`paginate_button page-item previous ${
currentPage === 1 ? "disabled" : ""
className={`paginate_button page-item previous ${currentPage === 1 ? "disabled" : ""
}`}
>
<a
@ -604,8 +603,7 @@ const principalDistributor = () => {
{Array.from({ length: totalPages }, (_, index) => (
<li
key={index}
className={`paginate_button page-item ${
currentPage === index + 1 ? "active" : ""
className={`paginate_button page-item ${currentPage === index + 1 ? "active" : ""
}`}
>
<a
@ -618,8 +616,7 @@ const principalDistributor = () => {
</li>
))}
<li
className={`paginate_button page-item next ${
currentPage === totalPages ? "disabled" : ""
className={`paginate_button page-item next ${currentPage === totalPages ? "disabled" : ""
}`}
>
<a

View File

@ -44,7 +44,7 @@ const AddMultiplerd = () => {
formData.append("file", file);
const { data } = await axios.post(
"/api/retaildistributor/upload",
"https://cheminova-api1.onrender.com/api/retaildistributor/upload",
formData,
{
headers: {
@ -95,8 +95,7 @@ const AddMultiplerd = () => {
console.error("Upload error:", error);
swal(
"Error",
`Failed to upload Retailers: ${
error.response?.data?.message || "An unexpected error occurred"
`Failed to upload Retailers: ${error.response?.data?.message || "An unexpected error occurred"
}`,
"error"
);

View File

@ -122,7 +122,7 @@ const RetailDistributor = () => {
const handleReset = async (id) => {
try {
const response = await axios.put(
`/api/rd/reset-password/${id}`,
`https://cheminova-api1.onrender.com/api/rd/reset-password/${id}`,
{}, // No body content required for this request
{
headers: {
@ -448,8 +448,7 @@ const RetailDistributor = () => {
<div className="dataTables_paginate paging_simple_numbers">
<ul className="pagination">
<li
className={`paginate_button page-item previous ${
currentPage === 1 ? "disabled" : ""
className={`paginate_button page-item previous ${currentPage === 1 ? "disabled" : ""
}`}
>
<a
@ -494,8 +493,7 @@ const RetailDistributor = () => {
return (
<li
key={index}
className={`paginate_button page-item ${
currentPage === page + index ? "active" : ""
className={`paginate_button page-item ${currentPage === page + index ? "active" : ""
}`}
>
<a
@ -510,8 +508,7 @@ const RetailDistributor = () => {
}
)}
<li
className={`paginate_button page-item next ${
currentPage === totalPages ? "disabled" : ""
className={`paginate_button page-item next ${currentPage === totalPages ? "disabled" : ""
}`}
>
<a

View File

@ -57,10 +57,10 @@ const AddRetailDistributor = () => {
value: state.isoCode,
}));
setStateOptions(states);
}, []);
}, []);
// Fetch city options whenever selected state changes
useEffect(() => {
// Fetch city options whenever selected state changes
useEffect(() => {
if (selectedState) {
const cities = City.getCitiesOfState("IN", selectedState.value).map(
(city) => ({
@ -72,7 +72,7 @@ useEffect(() => {
} else {
setCityOptions([]); // Reset cities if no state selected
}
}, [selectedState]);
}, [selectedState]);
const handleInputChange = (e) => {
setUser({ ...user, [e.target.name]: e.target.value });
@ -180,7 +180,7 @@ useEffect(() => {
});
// Attempt to create distributor
const response = await axios.post("/api/kyc/create-admin/", formData, {
const response = await axios.post("https://cheminova-api1.onrender.com/api/kyc/create-admin/", formData, {
headers: {
"Content-Type": "multipart/form-data",
Authorization: `Bearer ${token}`,

View File

@ -44,7 +44,7 @@ const AddMultiplesc = () => {
formData.append("file", file);
const { data } = await axios.post(
"/api/salescoordinator/upload",
"https://cheminova-api1.onrender.com/api/salescoordinator/upload",
formData,
{
headers: {
@ -98,8 +98,7 @@ const AddMultiplesc = () => {
console.error("Upload error:", error);
swal(
"Error",
`Failed to upload Sales Coordinators: ${
error.response?.data?.message || "An unexpected error occurred"
`Failed to upload Sales Coordinators: ${error.response?.data?.message || "An unexpected error occurred"
}`,
"error"
);

View File

@ -135,7 +135,7 @@ const AddSalesCoOrdinator = () => {
if (!validateForm()) return;
try {
await axios.post("/api/salescoordinator/register", formData, {
await axios.post("https://cheminova-api1.onrender.com/api/salescoordinator/register", formData, {
headers: {
Authorization: `Bearer ${token}`,
},

View File

@ -114,7 +114,7 @@ const SalesCoOrdinator = () => {
const handleReset = async (id) => {
try {
const response = await axios.put(
`/api/salescoordinator/reset-password/${id}`,
`https://cheminova-api1.onrender.com/api/salescoordinator/reset-password/${id}`,
{}, // No body content required for this request
{
headers: {
@ -314,8 +314,7 @@ const SalesCoOrdinator = () => {
</td>
<td className="text-start">
<span
className={`badge text-white ${
salescoordinator?.isVerified === true
className={`badge text-white ${salescoordinator?.isVerified === true
? "text-bg-success"
: "text-bg-danger"
}`}

View File

@ -44,7 +44,7 @@ const AddMultipletm = () => {
formData.append("file", file);
const { data } = await axios.post(
"/api/territorymanager/upload",
"https://cheminova-api1.onrender.com/api/territorymanager/upload",
formData,
{
headers: {
@ -98,8 +98,7 @@ const AddMultipletm = () => {
console.error("Upload error:", error);
swal(
"Error",
`Failed to upload Territory Managers: ${
error.response?.data?.message || "An unexpected error occurred"
`Failed to upload Territory Managers: ${error.response?.data?.message || "An unexpected error occurred"
}`,
"error"
);

View File

@ -51,7 +51,7 @@ const AddTerritoryManager = () => {
e.preventDefault();
if (!validateForm()) return;
try {
await axios.post("/api/territorymanager/register", formData, {
await axios.post("https://cheminova-api1.onrender.com/api/territorymanager/register", formData, {
headers: {
Authorization: `Bearer ${token}`,
},

View File

@ -114,7 +114,7 @@ const TerritoryManager = () => {
const handleReset = async (id) => {
try {
const response = await axios.put(
`/api/territorymanager/reset-password/${id}`,
`https://cheminova-api1.onrender.com/api/territorymanager/reset-password/${id}`,
{}, // No body content required for this request
{
headers: {
@ -312,8 +312,7 @@ const TerritoryManager = () => {
</td>
<td className="text-start">
<span
className={`badge text-white ${
territorymanager?.isVerified === true
className={`badge text-white ${territorymanager?.isVerified === true
? "text-bg-success"
: "text-bg-danger"
}`}