Skip to content

Commit ee0d912

Browse files
committed
Update API endpoints and URLs to reflect domain change; enhance error handling in data fetching
1 parent 2a4b7bd commit ee0d912

14 files changed

Lines changed: 129 additions & 60 deletions

File tree

components/Contact/ContactForm.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useState } from "react";
22
import axios from "axios";
33
import { ToastContainer, toast } from "react-toastify";
44
import "react-toastify/dist/ReactToastify.css";
5+
import { API_ENDPOINTS } from '@/utils/config';
56

67
function ContactForm() {
78
const [formData, setFormData] = useState({
@@ -97,7 +98,7 @@ function ContactForm() {
9798
});
9899

99100
axios
100-
.post("/api/v1/contact", {
101+
.post(API_ENDPOINTS.CONTACT.SEND_MESSAGE, {
101102
name: formData.name.trim(),
102103
email: formData.email.trim(),
103104
message: formData.message.trim()
@@ -230,8 +231,8 @@ function ContactForm() {
230231
onClick={handleSubmit}
231232
disabled={!isFormValid() || isSubmitting}
232233
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
233-
? "opacity-50 cursor-not-allowed"
234-
: "hover:bg-opacity-90"
234+
? "opacity-50 cursor-not-allowed"
235+
: "hover:bg-opacity-90"
235236
}`}
236237
>
237238
{isSubmitting ? "Submitting..." : "Submit"}

components/Home/Sponsors.jsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import React from 'react';
22
import { useEffect, useState } from "react";
3-
// const sponsors = [
4-
// { name: "SWOC", logo: "https://res.cloudinary.com/doslhy0tq/image/upload/v1729971260/SWOC_mfzb98.png" },
5-
// { name: "Linux Foundation", logo: "https://www.linuxfoundation.org/hubfs/lf-stacked-color.svg" },
6-
// { name: "Genxyz", logo: "https://res.cloudinary.com/doslhy0tq/image/upload/v1729540377/xyz-logo-color_mrldu1.svg" }
7-
// ];
3+
import { API_ENDPOINTS } from '@/utils/config';
84

95
const Sponsors = () => {
106
const [sponsors, setSponsors] = useState([]);
@@ -14,12 +10,21 @@ const Sponsors = () => {
1410
const fetchSponsors = async () => {
1511
try {
1612
setLoading(true);
17-
const response = await fetch("../api/v1/sponsers");
13+
const response = await fetch(API_ENDPOINTS.SPONSORS.GET_ALL);
1814
const result = await response.json();
19-
console.log("hello")
20-
setSponsors(result.data);
15+
16+
// Handle different response structures
17+
if (result.success && result.data) {
18+
setSponsors(result.data);
19+
} else if (Array.isArray(result)) {
20+
setSponsors(result);
21+
} else {
22+
console.error("Unexpected response format:", result);
23+
setSponsors([]);
24+
}
2125
} catch (error) {
2226
console.error("Error fetching sponsors:", error);
27+
setSponsors([]);
2328
} finally {
2429
setLoading(false);
2530
}

components/Shared/Navbar/Navbar.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const Navbar = () => {
4141
src="logo.png"
4242
className="h-8 md:h-10 cursor-pointer"
4343
onClick={() =>
44-
(window.location.href = "https://githubsrmist.tech/")
44+
(window.location.href = "https://githubsrmist.in/")
4545
}
4646
/>
4747
<ul className="hidden md:flex space-x-6">

next-sitemap.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
2-
siteUrl: 'https://githubsrmist.tech',
2+
siteUrl: 'https://githubsrmist.in',
33
generateRobotsTxt: true,
44
};

pages/_app.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ function MyApp({ Component, pageProps }) {
4242
<meta name="google-site-verification" content="google-site-verification= " />
4343
<meta property="og:site_name" content="GitHub Community SRM - The Official student-led community affiliated with GitHub, spearheading the open-source revolution at SRMIST." />
4444
<meta property="og:type" content="website" />
45-
<meta property="og:url" content="https://githubsrmist.tech" />
46-
<link rel="canonical" href="https://githubsrmist.tech" />
45+
<meta property="og:url" content="https://githubsrmist.in" />
46+
<link rel="canonical" href="https://githubsrmist.in" />
4747

4848
<meta property="image" content="../public/favicon.ico" />
4949
<meta
@@ -73,14 +73,14 @@ function MyApp({ Component, pageProps }) {
7373
<meta property="og:site_name" content="GitHub Community SRM" />
7474
<meta property="og:title" content="GitHub Community SRMIST | Open Source at SRMIST" />
7575
<meta property="og:description" content="GitHub Community SRM is the student-led open-source community at SRM Institute of Science and Technology." />
76-
<meta property="og:url" content="https://githubsrmist.tech" />
76+
<meta property="og:url" content="https://githubsrmist.in" />
7777
<meta property="og:image" content="/public/Logo.png" />
7878
<meta property="og:type" content="website" />
7979
<meta property="og:see_also" content="https://github.com/SRM-IST-KTR" />
8080
<meta property="og:see_also" content="https://www.instagram.com/githubsrm/" />
8181
<meta property="og:see_also" content="https://www.linkedin.com/company/githubsrm" />
8282

83-
<link rel="canonical" href="https://githubsrmist.tech" />
83+
<link rel="canonical" href="https://githubsrmist.in" />
8484

8585
<link rel="icon" href="/favicon.ico" />
8686

@@ -91,13 +91,13 @@ function MyApp({ Component, pageProps }) {
9191
"@context": "https://schema.org",
9292
"@type": "Organization",
9393
"name": "GitHub Community SRM",
94-
"url": "https://githubsrmist.tech",
95-
"logo": "https://githubsrmist.tech/logo.png",
94+
"url": "https://githubsrmist.in",
95+
"logo": "https://githubsrmist.in/logo.png",
9696
"contactPoint": {
9797
"@type": "ContactPoint",
98-
"email": "community@githubsrmist.tech",
98+
"email": "community@githubsrmist.in",
9999
"contactType": "Customer Support",
100-
"url": "https://githubsrmist.tech/contact"
100+
"url": "https://githubsrmist.in/contact"
101101
},
102102
"sameAs": [
103103
"https://www.instagram.com/githubsrm/",

pages/about.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function AboutUs() {
3434
/>
3535
<link
3636
rel="canonical"
37-
href="https://githubsrmist.tech/about"
37+
href="https://githubsrmist.in/about"
3838
/>
3939

4040
<meta name="twitter:card" content="/public/logo.png" />
@@ -50,7 +50,7 @@ function AboutUs() {
5050
<meta name="twitter:site" content="@GithubSrm" />
5151
<meta
5252
name="twitter:url"
53-
content="https://githubsrmist.tech/about"
53+
content="https://githubsrmist.in/about"
5454
/>
5555

5656
<meta
@@ -63,7 +63,7 @@ function AboutUs() {
6363
/>
6464
<meta
6565
property="og:url"
66-
content="https://githubsrmist.tech/about"
66+
content="https://githubsrmist.in/about"
6767
/>
6868
<meta property="og:image" content="/public/logo.png" />
6969
<meta property="og:type" content="website" />

pages/contact.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ const Contact = () => {
2222
<meta name="keywords" content="Contact, GitHub Community SRM, support, queries, FAQ, community help, reach out, open source support, SRMIST GitHub, GitHub Community support" />
2323
<link
2424
rel="canonical"
25-
href="https://githubsrmist.tech/contact"
25+
href="https://githubsrmist.in/contact"
2626
/>
2727
<meta property="og:title" content="Contact Us | GitHub Community SRM | Support & Queries" />
2828
<meta property="og:description" content="Need help or have a query? Contact the GitHub Community SRM team for assistance. Explore our FAQ section for quick answers." />
29-
<meta property="og:url" content="https://githubsrmist.tech/contact" />
29+
<meta property="og:url" content="https://githubsrmist.in/contact" />
3030
<meta property="og:type" content="website" />
3131
<meta property="og:site_name" content="GitHub Community SRM" />
3232
<meta property="og:image" content="/public/contact_us_image.png" />
@@ -36,19 +36,19 @@ const Contact = () => {
3636
<meta name="twitter:description" content="Need help or have a query? Contact the GitHub Community SRM team for support and assistance. Check out our FAQ section for quick answers." />
3737
<meta name="twitter:image" content="/public/Logo.png" />
3838
<meta name="twitter:site" content="@GithubSrm" />
39-
<meta name="twitter:url" content="https://githubsrmist.tech/contact" />
39+
<meta name="twitter:url" content="https://githubsrmist.in/contact" />
4040
<script type="application/ld+json">
4141
{JSON.stringify({
4242
"@context": "https://schema.org",
4343
"@type": "ContactPage",
44-
"url": "https://githubsrmist.tech/contact",
44+
"url": "https://githubsrmist.in/contact",
4545
"description": "Contact GitHub Community SRM for support, queries, or assistance. We are here to help with open source and community-related questions.",
4646
"contactOption": [
4747
{
4848
"@type": "ContactPoint",
4949
"telephone": "+91-9474182596",
5050
"contactType": "Customer Support",
51-
"email": "support@githubsrmist.tech"
51+
"email": "support@githubsrmist.in"
5252
}
5353
]
5454
})}

pages/events/index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import RegisterDialogue from "@/components/Events/Register_dialogue/Registerdial
77
import Hero from "@/components/Events/LiveEvents/Hero";
88
import heroimg_events from "@/public/heroimg_events.png";
99
import Head from "next/head";
10+
import { API_ENDPOINTS } from "@/utils/config";
1011

1112
const Events = () => {
1213
const [eventData, setEventData] = useState(null);
@@ -35,7 +36,7 @@ const Events = () => {
3536
useEffect(() => {
3637
const fetchData = async () => {
3738
try {
38-
const response = await fetch("../api/v1/events");
39+
const response = await fetch(API_ENDPOINTS.EVENTS.GET_ALL);
3940
if (!response.ok) {
4041
throw new Error("Failed to fetch data");
4142
}
@@ -91,7 +92,7 @@ const Events = () => {
9192
/>
9293
<meta
9394
property="og:image"
94-
content="https://githubsrmist.tech/logo.png"
95+
content="https://githubsrmist.in/logo.png"
9596
/>
9697
<meta
9798
property="og:image:alt"
@@ -108,18 +109,18 @@ const Events = () => {
108109
/>
109110
<meta
110111
name="twitter:image"
111-
content="https://githubsrmist.tech/logo.png"
112+
content="https://githubsrmist.in/logo.png"
112113
/>
113114

114115
<script type="application/ld+json">
115116
{JSON.stringify({
116117
"@context": "https://schema.org",
117118
"@type": "Event",
118119
name: "Hackathons, Workshops & Speaker Sessions | Github Community SRM Events",
119-
url: "https://githubsrmist.tech/events",
120+
url: "https://githubsrmist.in/events",
120121
description:
121122
"Discover and register for hackathons, workshops, and speaker sessions hosted by Github Community SRM.",
122-
image: "https://githubsrmist.tech/logo.png",
123+
image: "https://githubsrmist.in/logo.png",
123124
location: {
124125
"@type": "Place",
125126
name: "SRM Institute of Science and Technology",

pages/team.js

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import ProfileCard from "@/components/Team/profileCard";
44
import { CSSTransition, TransitionGroup } from "react-transition-group";
55
import Head from "next/head";
66
import { set } from "mongoose";
7+
import { API_ENDPOINTS } from '@/utils/config';
78

89
const ProfileSkeleton = () => {
910
return (
@@ -30,35 +31,42 @@ const Teams = () => {
3031
useEffect(() => {
3132
const fetchData = async () => {
3233
try {
33-
const response = await fetch("../api/v1/team");
34+
const response = await fetch(API_ENDPOINTS.TEAM.GET_ALL);
3435
if (!response.ok) {
3536
throw new Error("Failed to fetch data");
3637
}
3738
const data = await response.json();
3839

39-
const convenorData = data.data.find(
40+
// Handle both response formats: direct array or {data: array}
41+
const teamData = Array.isArray(data) ? data : (data.data || []);
42+
43+
const convenorData = teamData.find(
4044
(item) => item.position === "Convenor"
4145
);
42-
const presidentData = data.data.find(
46+
const presidentData = teamData.find(
4347
(item) => item.position === "President"
4448
);
45-
const vpData = data.data.find(
49+
const vpData = teamData.find(
4650
(item) => item.position === "vicePresident"
4751
);
4852

49-
// const adminsData = data.data.filter(
53+
console.log("Convenor:", convenorData);
54+
console.log("President:", presidentData);
55+
console.log("VP:", vpData);
56+
57+
// const adminsData = teamData.filter(
5058
// (item) => item.position === "Admin"
5159
// );
52-
const directorsData = data.data.filter(
60+
const directorsData = teamData.filter(
5361
(item) => item.position === "Director"
5462
);
55-
const leadsData = data.data.filter(
63+
const leadsData = teamData.filter(
5664
(item) => item.position === "Lead"
5765
);
58-
const associatesData = data.data.filter(
66+
const associatesData = teamData.filter(
5967
(item) => item.position === "Associate"
6068
);
61-
const membersData = data.data.filter(
69+
const membersData = teamData.filter(
6270
(item) => item.position === "Member"
6371
);
6472

@@ -72,7 +80,8 @@ const Teams = () => {
7280
setMembers(membersData);
7381
setFetched(true);
7482
} catch (error) {
75-
console.error(error);
83+
console.error("Error fetching team data:", error);
84+
setFetched(true); // Set to true even on error to stop loading state
7685
}
7786
};
7887

@@ -139,7 +148,7 @@ const Teams = () => {
139148
<meta property="og:title" content="Meet the Team | GitHub Community SRM | Technical, Corporate, Creative" />
140149
<meta property="og:description" content="Meet the team behind GitHub Community SRM, including the President, Vice President, Leads, Associates, and Members from the Technical, Corporate, and Creative domains." />
141150
<meta property="og:image" content="/public/Logo.png" />
142-
<meta property="og:url" content="https://githubsrmist.tech/team" />
151+
<meta property="og:url" content="https://githubsrmist.in/team" />
143152
<meta property="og:type" content="website" />
144153

145154
<meta name="twitter:card" content="/public/Logo.png" />
@@ -153,7 +162,7 @@ const Teams = () => {
153162
"@context": "https://schema.org",
154163
"@type": "Organization",
155164
"name": "GitHub Community SRM",
156-
"url": "https://githubsrmist.tech",
165+
"url": "https://githubsrmist.in",
157166
"logo": "/public/Logo.png",
158167
"sameAs": [
159168
"https://github.com/SRM-IST-KTR",
@@ -205,7 +214,7 @@ const Teams = () => {
205214
<div className="flex justify-center mt-8">
206215
<ProfileSkeleton />
207216
</div>
208-
) : (
217+
) : convenor ? (
209218
<div className="flex justify-center mt-8">
210219
<ProfileCard
211220
photo={convenor.pictureUrl}
@@ -214,6 +223,8 @@ const Teams = () => {
214223
socials={convenor.socials}
215224
/>
216225
</div>
226+
) : (
227+
<p className="text-center mt-8 text-gray-400">No convenor data available</p>
217228
)}
218229

219230
<div className="flex flex-col md:flex-row justify-center items-center gap-8 lg:gap-16 p-8 mt-16">
@@ -223,13 +234,15 @@ const Teams = () => {
223234
</h2>
224235
{!fetched ? (
225236
<ProfileSkeleton />
226-
) : (
237+
) : president ? (
227238
<ProfileCard
228239
photo={president.pictureUrl}
229240
name={president.name}
230241
caption={president.caption}
231242
socials={president.socials}
232243
/>
244+
) : (
245+
<p className="text-center text-gray-400">No president data available</p>
233246
)}
234247
</div>
235248

@@ -239,13 +252,15 @@ const Teams = () => {
239252
</h2>
240253
{!fetched ? (
241254
<ProfileSkeleton />
242-
) : (
255+
) : vp ? (
243256
<ProfileCard
244257
photo={vp.pictureUrl}
245258
name={vp.name}
246259
caption={vp.caption}
247260
socials={vp.socials}
248261
/>
262+
) : (
263+
<p className="text-center text-gray-400">No vice president data available</p>
249264
)}
250265
</div>
251266
</div>

public/robots.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ User-agent: *
33
Allow: /
44

55
# Host
6-
Host: https://githubsrmist.tech
6+
Host: https://githubsrmist.in
77

88
# Sitemaps
9-
Sitemap: https://githubsrmist.tech/sitemap.xml
9+
Sitemap: https://githubsrmist.in/sitemap.xml

0 commit comments

Comments
 (0)