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

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