Skip to content

Commit 290eab3

Browse files
committed
connected new instance of db
1 parent 9216302 commit 290eab3

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

www/src/pages/components/LandingPage.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ export default function LandingPage() {
1111
const [name, setName] = useState('');
1212
const [email, setEmail] = useState('');
1313
const { mutate } = trpc.user.createUser.useMutation();
14-
14+
1515
const handleSubmit = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
1616
e.preventDefault();
1717
// grab the information of name and email
1818
// bundle those together to be an object to be sent to backend
1919
mutate({name, email});
20+
setName('');
21+
setEmail('');
2022
}
2123

2224
return (

www/src/server/trpc/router/user.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { router, publicProcedure } from "../trpc";
44

55
export const userRouter = router({
66
createUser: publicProcedure
7-
.input(z.object({
8-
name: z.string(),
7+
.input(z.object({
8+
name: z.string(),
99
email: z.string().email()}),
10-
10+
1111
) // name and email
1212
.mutation(async ({ input, ctx }) => {
1313
// we want to add to our database with the name, email, admin defaulted to false as column values
@@ -17,7 +17,9 @@ export const userRouter = router({
1717
email: input.email,
1818
}
1919
})
20-
})
20+
}),
21+
getAllUsers: publicProcedure
22+
.query()
2123
});
2224

2325

0 commit comments

Comments
 (0)