File tree Expand file tree Collapse file tree 4 files changed +16
-16
lines changed Expand file tree Collapse file tree 4 files changed +16
-16
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ yarn-error.log*
27
27
28
28
# local env files
29
29
.env * .local
30
+ .env *
30
31
31
32
# vercel
32
33
.vercel
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ import { z } from "zod";
3
3
import prisma from "@/prisma/client" ;
4
4
5
5
const createUserSchema = z . object ( {
6
- firstname : z . string ( ) . min ( 1 ) . max ( 25 ) ,
7
- lastname : z . string ( ) . min ( 1 ) . max ( 25 ) ,
6
+ firstName : z . string ( ) . min ( 1 ) . max ( 25 ) ,
7
+ lastName : z . string ( ) . min ( 1 ) . max ( 25 ) ,
8
8
notes : z . string ( ) . min ( 1 ) ,
9
9
} ) ;
10
10
@@ -14,10 +14,10 @@ export async function POST(request: NextRequest) {
14
14
if ( ! validation . success )
15
15
return NextResponse . json ( validation . error . errors , { status : 400 } ) ;
16
16
17
- const newUser = await prisma . user . create ( {
17
+ const newUser = await prisma . users . create ( {
18
18
data : {
19
- firstname : body . firstname ,
20
- lastname : body . lastname ,
19
+ firstname : body . firstName ,
20
+ lastname : body . lastName ,
21
21
notes : body . notes ,
22
22
} ,
23
23
} ) ;
Original file line number Diff line number Diff line change 1
- " use client" ;
1
+ ' use client' ;
2
2
import Link from "next/link" ;
3
- import SimpleMDE from "react-simplemde-editor" ;
4
3
import "easymde/dist/easymde.min.css" ;
5
4
import { useForm , Controller } from "react-hook-form" ;
6
5
import { Button , TextField } from "@radix-ui/themes" ;
7
6
import axios from "axios" ;
8
7
import { useRouter } from "next/navigation" ;
8
+ import dynamic from "next/dynamic" ;
9
+
10
+ const SimpleMdeEditor = dynamic (
11
+ ( ) => import ( "react-simplemde-editor" ) ,
12
+ { ssr : false }
13
+ ) ;
9
14
10
15
const NewUser = ( ) => {
11
16
const router = useRouter ( ) ;
@@ -17,12 +22,13 @@ const NewUser = () => {
17
22
const {
18
23
register,
19
24
control,
25
+ reset,
20
26
handleSubmit,
21
27
formState : { errors } ,
22
28
} = useForm < UserForm > ( ) ;
23
29
const onSubmit = handleSubmit ( async ( data ) => {
24
30
await axios . post ( "/api/users" , data ) ;
25
- router . push ( "/users/new" ) ;
31
+ reset ( )
26
32
} ) ;
27
33
// firstName and lastName will have correct type
28
34
return (
@@ -45,7 +51,7 @@ const NewUser = () => {
45
51
name = "notes"
46
52
control = { control }
47
53
render = { ( { field } ) => (
48
- < SimpleMDE placeholder = "notes..." { ...field } />
54
+ < SimpleMdeEditor placeholder = "notes..." { ...field } />
49
55
) }
50
56
/>
51
57
You can’t perform that action at this time.
0 commit comments