Skip to content

Commit

Permalink
fix; アイテム追加できない問題を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
toririm committed Sep 23, 2024
1 parent c98e9d3 commit 4dba4d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/routes/items/actions/addItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { itemRepository } from "~/repositories/item";
// TODO(toririm): テストを書く
export const addItem: ClientActionFunction = async ({ request }) => {
const formData = await request.formData();
const submission = parseWithZod(formData, { schema: itemSchema });
const submission = parseWithZod(formData, {
schema: itemSchema.omit({ assignee: true }),
});

if (submission.status !== "success") {
console.error("Invalid form data", submission.reply());
Expand Down
4 changes: 3 additions & 1 deletion app/routes/items/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ export default function Item() {
const [form, fields] = useForm({
lastResult: navigation.state === "idle" ? lastResult : null,
onValidate({ formData }) {
return parseWithZod(formData, { schema: itemSchema });
return parseWithZod(formData, {
schema: itemSchema.omit({ assignee: true }),
});
},
shouldValidate: "onBlur",
shouldRevalidate: "onInput",
Expand Down

0 comments on commit 4dba4d0

Please sign in to comment.