diff --git a/components/Contact/ContactForm.jsx b/components/Contact/ContactForm.jsx index a499b8e..ce158f1 100644 --- a/components/Contact/ContactForm.jsx +++ b/components/Contact/ContactForm.jsx @@ -2,6 +2,7 @@ import React, { useState } from "react"; import axios from "axios"; import { ToastContainer, toast } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; +import { API_ENDPOINTS } from '@/utils/config'; function ContactForm() { const [formData, setFormData] = useState({ @@ -97,7 +98,7 @@ function ContactForm() { }); axios - .post("/api/v1/contact", { + .post(API_ENDPOINTS.CONTACT.SEND_MESSAGE, { name: formData.name.trim(), email: formData.email.trim(), message: formData.message.trim() @@ -230,8 +231,8 @@ function ContactForm() { onClick={handleSubmit} disabled={!isFormValid() || isSubmitting} className={`text-black bg-bright_green font-dmSans font-bold text-md md:text-lg rounded-full py-3 md:py-4 px-4 w-[40%] my-6 mx-auto transition-opacity ${!isFormValid() || isSubmitting - ? "opacity-50 cursor-not-allowed" - : "hover:bg-opacity-90" + ? "opacity-50 cursor-not-allowed" + : "hover:bg-opacity-90" }`} > {isSubmitting ? "Submitting..." : "Submit"} diff --git a/components/Home/Sponsors.jsx b/components/Home/Sponsors.jsx index 650e2d7..44613a9 100644 --- a/components/Home/Sponsors.jsx +++ b/components/Home/Sponsors.jsx @@ -1,10 +1,6 @@ import React from 'react'; import { useEffect, useState } from "react"; -// const sponsors = [ -// { name: "SWOC", logo: "https://res.cloudinary.com/doslhy0tq/image/upload/v1729971260/SWOC_mfzb98.png" }, -// { name: "Linux Foundation", logo: "https://www.linuxfoundation.org/hubfs/lf-stacked-color.svg" }, -// { name: "Genxyz", logo: "https://res.cloudinary.com/doslhy0tq/image/upload/v1729540377/xyz-logo-color_mrldu1.svg" } -// ]; +import { API_ENDPOINTS } from '@/utils/config'; const Sponsors = () => { const [sponsors, setSponsors] = useState([]); @@ -14,12 +10,21 @@ const Sponsors = () => { const fetchSponsors = async () => { try { setLoading(true); - const response = await fetch("../api/v1/sponsers"); + const response = await fetch(API_ENDPOINTS.SPONSORS.GET_ALL); const result = await response.json(); - console.log("hello") - setSponsors(result.data); + + // Handle different response structures + if (result.success && result.data) { + setSponsors(result.data); + } else if (Array.isArray(result)) { + setSponsors(result); + } else { + console.error("Unexpected response format:", result); + setSponsors([]); + } } catch (error) { console.error("Error fetching sponsors:", error); + setSponsors([]); } finally { setLoading(false); } diff --git a/components/Shared/Navbar/Navbar.jsx b/components/Shared/Navbar/Navbar.jsx index 5935fe7..cb222c0 100644 --- a/components/Shared/Navbar/Navbar.jsx +++ b/components/Shared/Navbar/Navbar.jsx @@ -41,7 +41,7 @@ const Navbar = () => { src="logo.png" className="h-8 md:h-10 cursor-pointer" onClick={() => - (window.location.href = "https://githubsrmist.tech/") + (window.location.href = "https://githubsrmist.in/") } />