File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -66,18 +66,20 @@ Running a mutation looks like
6666
6767``` svelte
6868<script>
69- const client = useConvexClient();
70-
71- let toSend = $state('');
72- let author = $state('me');
73-
74- function onSubmit(e: SubmitEvent) {
75- const data = Object.fromEntries(new FormData(e.target as HTMLFormElement).entries());
76- client.mutation(api.messages.send, {
77- author: data.author as string,
78- body: data.body as string
79- });
80- }
69+ import { api } from "../../convex/_generated/api.js"; // depending on file location
70+ import { useConvexClient, useQuery } from "convex-svelte";
71+ const client = useConvexClient();
72+
73+ let toSend = $state('');
74+ let author = $state('me');
75+
76+ function onSubmit(e: SubmitEvent) {
77+ const data = Object.fromEntries(new FormData(e.target as HTMLFormElement).entries());
78+ client.mutation(api.messages.send, {
79+ author: data.author as string,
80+ body: data.body as string
81+ });
82+ }
8183</script>
8284
8385<form on:submit|preventDefault={onSubmit}>
You can’t perform that action at this time.
0 commit comments