From c8808764d626204ab05c2f9639290710adf57706 Mon Sep 17 00:00:00 2001 From: SiddharthaMishra-dev Date: Mon, 8 Jan 2024 20:25:58 +0530 Subject: [PATCH] chore: remove create route and misc UI changes --- app/blogs/page.tsx | 1 - app/create/loading.tsx | 12 ----- app/create/page.tsx | 96 ----------------------------------- app/protected/[user]/page.tsx | 12 ++--- components/BlogCard.tsx | 10 +--- utils/BaseUrl.ts | 0 utils/connectMongo.js | 4 +- 7 files changed, 8 insertions(+), 127 deletions(-) delete mode 100644 app/create/loading.tsx delete mode 100644 app/create/page.tsx create mode 100644 utils/BaseUrl.ts diff --git a/app/blogs/page.tsx b/app/blogs/page.tsx index 133f654..600a0bb 100644 --- a/app/blogs/page.tsx +++ b/app/blogs/page.tsx @@ -1,5 +1,4 @@ "use client"; - import getBlogs from "@/actions/getBlogs"; import BlogList from "@/components/BlogList"; diff --git a/app/create/loading.tsx b/app/create/loading.tsx deleted file mode 100644 index e9a1bac..0000000 --- a/app/create/loading.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import React from "react"; -import Loader from "@/components/Loader"; - -const Loading = () => { - return ( - <> - - - ); -}; - -export default Loading; diff --git a/app/create/page.tsx b/app/create/page.tsx deleted file mode 100644 index 27e2c68..0000000 --- a/app/create/page.tsx +++ /dev/null @@ -1,96 +0,0 @@ -"use client"; - -import { useState } from "react"; -import { useSession } from "next-auth/react"; -import { useRouter } from "next/navigation"; -import { Button, Input, Textarea } from "@nextui-org/react"; -import { useForm, SubmitHandler, FieldValues } from "react-hook-form"; -import toast from "react-hot-toast"; - -export default function Index() { - const [isLoading, setIsLoading] = useState(false); - const router = useRouter(); - const { data: session } = useSession(); - const { register, reset, handleSubmit } = useForm({ - defaultValues: { - title: "", - hashtags: "", - content: "", - likes: [], - }, - }); - - const onSubmit: SubmitHandler = async (values) => { - setIsLoading(true); - try { - if (!session) { - return router.push("/signin"); - } - const response = await fetch("/api/user", { - method: "POST", - body: JSON.stringify({ ...values, session }), - }); - setIsLoading(false); - toast.success("Your Blog has been posted"); - reset(); - router.push("/blogs"); - } catch (error) { - toast.error("Something went wrong"); - } finally { - setIsLoading(false); - } - }; - - return ( -
-
-
-

Jot down your thought

-
- - -
-
- -
- -
-
-
- -