|
1 | | -"use client"; |
| 1 | +// "use client"; |
2 | 2 |
|
3 | | -import { useRouter } from "next/navigation"; |
4 | | -import { useState } from "react"; |
| 3 | +// import { useRouter } from "next/navigation"; |
| 4 | +// import { useState } from "react"; |
5 | 5 |
|
6 | | -import { api } from "~/trpc/react"; |
| 6 | +// import { api } from "~/trpc/react"; |
7 | 7 |
|
8 | | -export function CreatePost() { |
9 | | - const router = useRouter(); |
10 | | - const [name, setName] = useState(""); |
| 8 | +// export function CreatePost() { |
| 9 | +// const router = useRouter(); |
| 10 | +// const [name, setName] = useState(""); |
11 | 11 |
|
12 | | - const createPost = api.post.create.useMutation({ |
13 | | - onSuccess: () => { |
14 | | - router.refresh(); |
15 | | - setName(""); |
16 | | - }, |
17 | | - }); |
| 12 | +// const createPost = api.post.create.useMutation({ |
| 13 | +// onSuccess: () => { |
| 14 | +// router.refresh(); |
| 15 | +// setName(""); |
| 16 | +// }, |
| 17 | +// }); |
18 | 18 |
|
19 | | - return ( |
20 | | - <form |
21 | | - onSubmit={(e) => { |
22 | | - e.preventDefault(); |
23 | | - createPost.mutate({ name }); |
24 | | - }} |
25 | | - className="flex flex-col gap-2" |
26 | | - > |
27 | | - <input |
28 | | - type="text" |
29 | | - placeholder="Title" |
30 | | - value={name} |
31 | | - onChange={(e) => setName(e.target.value)} |
32 | | - className="w-full rounded-full px-4 py-2 text-black" |
33 | | - /> |
34 | | - <button |
35 | | - type="submit" |
36 | | - className="rounded-full bg-white/10 px-10 py-3 font-semibold transition hover:bg-white/20" |
37 | | - disabled={createPost.isPending} |
38 | | - > |
39 | | - {createPost.isPending ? "Submitting..." : "Submit"} |
40 | | - </button> |
41 | | - </form> |
42 | | - ); |
43 | | -} |
| 19 | +// return ( |
| 20 | +// <form |
| 21 | +// onSubmit={(e) => { |
| 22 | +// e.preventDefault(); |
| 23 | +// createPost.mutate({ name }); |
| 24 | +// }} |
| 25 | +// className="flex flex-col gap-2" |
| 26 | +// > |
| 27 | +// <input |
| 28 | +// type="text" |
| 29 | +// placeholder="Title" |
| 30 | +// value={name} |
| 31 | +// onChange={(e) => setName(e.target.value)} |
| 32 | +// className="w-full rounded-full px-4 py-2 text-black" |
| 33 | +// /> |
| 34 | +// <button |
| 35 | +// type="submit" |
| 36 | +// className="rounded-full bg-white/10 px-10 py-3 font-semibold transition hover:bg-white/20" |
| 37 | +// disabled={createPost.isPending} |
| 38 | +// > |
| 39 | +// {createPost.isPending ? "Submitting..." : "Submit"} |
| 40 | +// </button> |
| 41 | +// </form> |
| 42 | +// ); |
| 43 | +// } |
0 commit comments