Skip to content

Commit

Permalink
chore: Update API endpoints to use new server IP address
Browse files Browse the repository at this point in the history
  • Loading branch information
mukilan2815 committed Jul 22, 2024
1 parent aea9110 commit 98bc97e
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/Pages/Admin/Allmembers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Allmembers = () => {

try {
const response = await fetch(
"http://192.168.169.77:8000/membershipform/",
"http://192.168.12.72:8000/membershipform/",
{
headers: {
Authorization: token,
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Admin/Analysis.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const Dashboard = () => {

useEffect(() => {
axios
.get("http://192.168.169.77:8000/membershipform/")
.get("http://192.168.12.72:8000/membershipform/")
.then((response) => {
console.log("API response:", response.data); // Debugging log
setFormData(response.data);
Expand Down
8 changes: 5 additions & 3 deletions src/Pages/Admin/Approvalpage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const ApprovalPage = () => {
setLoading(true);
try {
const token = localStorage.getItem("token");
const response = await axios.get("http://192.168.169.77:8000/approval/", {
const response = await axios.get("http://192.168.12.72:8000/approval/", {
headers: {
Authorization: `Token ${token}`,
},
Expand All @@ -24,6 +24,8 @@ const ApprovalPage = () => {
setPendingApplications(response.data.pending);
setRejectedApplications(response.data.rejected);
setApprovedApplications(response.data.approved);

console.log("Rejected Applications:", response.data.rejected); // Add this line to verify rejected applications
} catch (error) {
console.error("Error fetching data:", error);
setError(error.message);
Expand All @@ -40,7 +42,7 @@ const ApprovalPage = () => {
try {
const token = localStorage.getItem("token");
await axios.post(
"http://192.168.169.77:8000/approval/",
"http://192.168.12.72:8000/approval/",
{ fid, status: "accepted" },
{
headers: {
Expand All @@ -60,7 +62,7 @@ const ApprovalPage = () => {
try {
const token = localStorage.getItem("token");
await axios.post(
"http://192.168.169.77:8000/approval/",
"http://192.168.12.72:8000/approval/",
{ fid, reason },
{
headers: {
Expand Down
16 changes: 12 additions & 4 deletions src/Pages/Admin/Home.jsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
import React from "react";
import React, { useEffect } from "react";
import { useNavigate } from "react-router-dom";
import "../../index.css";
import Navbar from "./Navbar";

function Home() {
const navigate = useNavigate();

useEffect(() => {
const token = localStorage.getItem("token"); // Adjust the key name as necessary
if (!token) {
navigate("/adminlogin");
}
}, [navigate]);

const handleMembership = () => {
navigate("/membership");
};

return (
<div>
<Navbar />
<div className=" z-0 overflow-x-hidden bg-slate-900 h-screen relative pt-40 pb-20 lg:pt-44">
<div className="relative xl:container m-auto px-6 md:px-12 lg:px-6">
<div className="z-0 overflow-x-hidden bg-slate-900 h-screen relative pt-40 pb-20 lg:pt-44">
<div className="relative xl:container m-auto px-6 md:px-12 lg:px-6">
<div className="w-10 h-10 bg-transparent border-4 border-blue-600 animate-spin1"></div>
<h1 className="sm:mx-auto sm:w-10/12 md:w-2/3 font-extrabold text-white text-4xl text-center sm:text-5xl md:text-6xl lg:w-auto lg:text-left xl:text-7xl dark:text-white">
The Indian Chamber of Commerce and Industry
<br className="lg:block hidden" />
<span className="relative text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-cyan-500 dark:from-blue-400 dark:to-cyan-300">
Branding coimbatore is our business
Branding Coimbatore is our business
</span>
.
</h1>
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Admin/LoginAdmin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const LoginAdmin = () => {
const password = formData.get("password");

try {
const response = await axios.post("http://192.168.169.77:8000/login/", {
const response = await axios.post("http://192.168.12.72:8000/login/", {
username,
password,
});
Expand Down
22 changes: 17 additions & 5 deletions src/Pages/Client/ExistingMember/Formexisting.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useState, useEffect } from "react";
import { useNavigate } from "react-router-dom";
import Header from "../../../Assets/Formheader.png";
import icci from "../../../Assets/Formheader.png";
Expand Down Expand Up @@ -83,6 +83,16 @@ const Formexisting = () => {
});

const [legalInfo, setLegalInfo] = "Your legal information here.";
useEffect(() => {
const storedData = localStorage.getItem("formData");
if (storedData) {
const parsedData = JSON.parse(storedData);
setFormData((prevState) => ({
...prevState,
...parsedData,
}));
}
}, []);

const labels = [
"Proprietary Firm",
Expand All @@ -94,7 +104,9 @@ const Formexisting = () => {
"Society",
"Associations",
];

useEffect(() => {
localStorage.setItem("formData", JSON.stringify(formData));
}, [formData]);
const [documentOptions, setDocOpt] = useState([
{
name: "Income Tax PAN Number",
Expand Down Expand Up @@ -221,8 +233,8 @@ const Formexisting = () => {
try {
e.preventDefault();

const response = await axios.post(
"http://192.168.169.77:8000/membershipform/",
const response = await axios.put(
"http://192.168.12.72:8000/existinglogin/",
formData,
{
headers: {
Expand Down Expand Up @@ -262,7 +274,7 @@ const Formexisting = () => {
<input
type="text"
name="applicantName"
value={formData.applicantName}
value={formData.applicantName || ""}
onChange={handleInputChange}
className="border rounded px-2 flex-grow"
/>
Expand Down
30 changes: 28 additions & 2 deletions src/Pages/Client/ExistingMember/Login.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
import React from "react";
import React, { useState } from "react";
import icci from "../../../Assets/icci.jpg";
import axios from "axios";
import { useNavigate } from "react-router-dom";
const Login = () => {
const navigate = useNavigate();
const [email, setemail] = useState();
const [aadhar, setaadhar] = useState();
const [error, setError] = useState();
const handleSubmit = async (e) => {
e.preventDefault();
try {
const response = await axios.post(
"http://192.168.12.72:8000/existinglogin/",
{
email,
aadhar,
}
);
console.log(response.data);
localStorage.setItem("Data", JSON.stringify(response.data));
navigate("/formexisting");
} catch (error) {
setError("Invalid username or password");
}
};
return (
<div className=" bg-slate-200 h-screen">
<div className="flex min-h-full flex-col justify-center px-6 py-12 lg:px-8">
<div className="sm:mx-auto sm:w-full sm:max-w-sm">
<img className="mx-auto h-20 w-auto" src={icci} alt="Chamber" />
<h2 className="mt-10 text-center text-2xl font-bold leading-9 tracking-tight text-gray-900">
<h2 className="mt-10 text-center text-2xl font-bold leading-9 tracking-tight text-gray-900">
Log in to your account
</h2>
</div>
Expand All @@ -27,6 +50,7 @@ const Login = () => {
type="email"
autocomplete="email"
required
onChange={(e) => setemail(e.target.value)}
className="block px-3 w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
/>
</div>
Expand All @@ -46,6 +70,7 @@ const Login = () => {
type="aadhar"
autocomplete="aadhar"
required
onChange={(e) => setaadhar(e.target.value)}
className="block px-3 w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
/>
</div>
Expand All @@ -54,6 +79,7 @@ const Login = () => {
<div>
<button
type="submit"
onClick={handleSubmit}
className="bg-blue-500 cursor-pointer px-6 py-3 rounded-lg text-white font-bold"
>
Login
Expand Down
5 changes: 1 addition & 4 deletions src/Pages/Client/NewMember/Membershipform.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import React, { useState } from "react";
import { useNavigate } from "react-router-dom";
import Header from "../../../Assets/Formheader.png";
import icci from "../../../Assets/Formheader.png";
import axios from "axios";

const Membershipform = () => {
const navigate = useNavigate();
const currentDate = new Date().toLocaleDateString();
const currentYear = new Date().getFullYear();
const [checkedItems, setCheckedItems] = useState({});
const [files, setFiles] = useState({});
const [image, setImage] = useState(null);
const [isMember, setIsMember] = useState(false);
const [isYesChecked, setIsYesChecked] = useState(false);
Expand Down Expand Up @@ -222,7 +219,7 @@ const Membershipform = () => {
e.preventDefault();

const response = await axios.post(
"http://192.168.169.77:8000/membershipform/",
"http://192.168.12.72:8000/membershipform/",
formData,
{
headers: {
Expand Down
2 changes: 0 additions & 2 deletions src/Pages/Client/NewMember/Payment.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useState } from "react";
import axios from "axios";
import { useNavigate } from "react-router-dom";

const MembershipPrices = {
Expand Down Expand Up @@ -74,7 +73,6 @@ const Payment = () => {
}));
};

const [formData2, setFormData2] = useState();
const accessToken = localStorage.getItem("token");

console.log(accessToken);
Expand Down

0 comments on commit 98bc97e

Please sign in to comment.