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 //Old render deploy
// axios.defaults.baseURL = "https://cheminova-api-2.onrender.com"; // axios.defaults.baseURL = "https://cheminova-api-2.onrender.com";
//latest render deploy //latest render deploy
axios.defaults.baseURL = "https://cheminova-api1.onrender.com" //axios.defaults.baseURL = "https://cheminova-api1.onrender.com"
//axios.defaults.baseURL = "https://api.cnapp.co.in"; axios.defaults.baseURL = "https://api.cnapp.co.in";
axios.defaults.headers = { axios.defaults.headers = {
"Cache-Control": "no-cache,no-store", "Cache-Control": "no-cache,no-store",

View File

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

View File

@ -121,7 +121,7 @@ const AddPrincipalDistributor = () => {
setLoading(true); setLoading(true);
// Attempt to register user // 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, ...user,
role: "principal-Distributor", role: "principal-Distributor",
}); });

View File

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

View File

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

View File

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

View File

@ -180,7 +180,7 @@ useEffect(() => {
}); });
// Attempt to create distributor // 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: { headers: {
"Content-Type": "multipart/form-data", "Content-Type": "multipart/form-data",
Authorization: `Bearer ${token}`, Authorization: `Bearer ${token}`,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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