Skip to content

Commit 8922214

Browse files
committed
fixed contact router
1 parent 7039947 commit 8922214

File tree

13 files changed

+40
-20
lines changed

13 files changed

+40
-20
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"react": "^18.3.1",
3030
"react-dom": "^18.3.1",
3131
"react-hook-form": "^7.54.2",
32+
"react-hot-toast": "^2.5.2",
3233
"react-icons": "^5.5.0",
3334
"react-photo-collage": "^1.0.9",
3435
"react-responsive": "^10.0.0",

pnpm-lock.yaml

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/api/getsingleblogpost/route.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export async function GET(req: NextRequest) {
66
const response = await axios.get(
77
`https://discoverwithsac-bitspilani.in/2025/main/api/posts/${blogId}`
88
);
9-
console.log(response.data);
109

1110
return NextResponse.json(response.data);
1211
}

src/app/api/getsingleevent/route.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export async function GET(req: NextRequest) {
66
const response = await axios.get(
77
`https://discoverwithsac-bitspilani.in/2025/main/api/events/${eventId}`
88
);
9-
console.log(response.data);
109

1110
return NextResponse.json(response.data);
1211
}

src/app/api/postcomments/route.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export async function POST(req: NextRequest) {
1111
},
1212
}
1313
);
14-
console.log(response.data);
1514

1615
return NextResponse.json(commentData);
1716
}

src/app/api/postform/route.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ import { NextRequest, NextResponse } from "next/server";
33
import axios from "axios";
44

55
export async function POST(req: NextRequest) {
6-
console.log("Route /api/events/postform hit");
7-
86
const { formData } = await req.json();
9-
console.log("Received Form Data:", formData);
107

118
try {
129
const response = await axios.post(
@@ -19,7 +16,6 @@ export async function POST(req: NextRequest) {
1916
}
2017
);
2118

22-
console.log("API Response:", response.data);
2319
return NextResponse.json({ success: true, message: "Form submitted!" });
2420
} catch (error) {
2521
console.error("Error sending form data:", error);

src/app/blogs/[blogId]/page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@ const SingleResourcePage = ({ params }: PageProps) => {
1616
const { blogId } = resolvedParams;
1717

1818
const [currentBlogPost, setCurrentBlogPost] = useState<BlogPostType | null>(null);
19-
console.log(currentBlogPost)
2019

2120
useEffect(() => {
2221
const getData = async () => {
2322
try {
2423
const response = await axios.get("/api/getsingleblogpost", {
2524
params: { blogId }
2625
});
27-
console.log("here is the reponse", response.data)
26+
2827
setCurrentBlogPost(response.data as BlogPostType);
2928
} catch (e) {
3029
console.log("There was some error", e);
@@ -43,7 +42,7 @@ const SingleResourcePage = ({ params }: PageProps) => {
4342
</div>
4443
);
4544
}
46-
console.log(currentBlogPost)
45+
4746

4847
return (
4948
<div className="w-full justify-center min-h-full">

src/app/blogs/page.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import BlogSkeleton from "@/components/blogs/blog-skeleton";
1414

1515
const BlogsPage = () => {
1616
const [blogPosts, setBlogPosts] = useState<BlogPostType[] | null>(null);
17-
console.log(blogPosts)
1817

1918
useEffect(() => {
2019
const getData = async () => {
@@ -26,7 +25,7 @@ const BlogsPage = () => {
2625
image: convertGoogleDriveUrl(post.image),
2726
}));
2827
setBlogPosts(transformedPosts);
29-
console.log(transformedPosts);
28+
3029
} catch (e) {
3130
console.log("There was some error", e);
3231
}

src/app/events/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const EventsPage = () => {
3939
getEvents()
4040
// setEvents(undefined)
4141
}, [])
42-
console.log(events)
42+
4343

4444
return (
4545
<div className='max-w-[1660px] mx-auto py-7 space-y-10'>

src/app/layout.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import "./globals.css";
33
import { Inter } from 'next/font/google'
44
import { cn } from "@/lib/utils";
55
import Footer from "@/components/Footer";
6+
import { Toaster } from "react-hot-toast";
7+
68
const inter = Inter({
79
subsets: ["latin"], // Choose subsets based on your needs
810
// Optional custom variable
@@ -18,6 +20,7 @@ export default function RootLayout({
1820
className=" w-full h-screen"
1921
>
2022
<Navbar />
23+
<Toaster />
2124

2225
{children}
2326
<Footer />

src/components/blogs/singular-blog.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,8 @@ const SingularBlogPost: React.FC<SingularBlogPostProps> = ({
2525
}
2626
};
2727

28-
console.log("Checking for valid url")
29-
console.log(isValidUrl(imageUrl))
30-
console.log(imageUrl)
3128
// Default image URL to use when image is invalid or fails to load
3229

33-
3430
// Determine which image URL to use
3531
const safeImageUrl = imgError || !isValidUrl(imageUrl) ? defaultImageUrl : imageUrl;
3632

src/components/contact-page/contact-us-form.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
} from "@/components/ui/form";
1919
import { Input } from "@/components/ui/input";
2020
import axios from "axios";
21+
import toast from "react-hot-toast";
2122

2223
const ContactUsForm = () => {
2324
const form = useForm<formSchemaType>({
@@ -34,10 +35,12 @@ const ContactUsForm = () => {
3435
const response = await axios.post("/api/postform", {
3536
formData: values,
3637
});
37-
38+
toast.success("Thanks For Your FeedBack!");
3839
console.log("Success:", response.data);
40+
form.reset();
3941

4042
} catch (error) {
43+
toast.error("Submission failed. Please try again.");
4144
console.error("Submission failed:", error);
4245

4346
}
@@ -112,7 +115,7 @@ const ContactUsForm = () => {
112115

113116
<Button
114117
type="submit"
115-
className="w-fit mx-auto bg-[#ffedb8] text-black font-semibold"
118+
className="w-fit mx-auto bg-[#ffedb8] text-black font-semibold hover:bg-[#eecf73]"
116119
>
117120
Submit
118121
</Button>

src/components/home/blog-crousel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface ImageItem {
1313

1414
const BlogCarousel = () => {
1515
const [blogData, setBlogData] = useState<ImageItem[]>([]);
16-
console.log(blogData)
16+
1717
useEffect(() => {
1818
const fetchData = async () => {
1919
try {

0 commit comments

Comments
 (0)