feat(web): adopt MutationError across create/object forms; distinguish edit-form fetch error (#63)
This commit is contained in:
@@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next";
|
||||
import { useVocabularies, useCreateVocabulary, useRenameVocabulary, useDeleteVocabulary } from "../api/queries";
|
||||
import { byKey } from "../lib/sort";
|
||||
import { DeleteConfirmDialog } from "../components/delete-confirm-dialog";
|
||||
import { MutationError } from "../components/mutation-error";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
@@ -54,11 +55,7 @@ export function VocabularyList() {
|
||||
{t("vocab.create")}
|
||||
</Button>
|
||||
</div>
|
||||
{create.isError && (
|
||||
<p role="alert" className="text-xs text-destructive">
|
||||
{t("form.rejected")}
|
||||
</p>
|
||||
)}
|
||||
<MutationError error={create.error} />
|
||||
</form>
|
||||
<div className="border-b p-2">
|
||||
<Input
|
||||
@@ -106,11 +103,7 @@ export function VocabularyList() {
|
||||
<Button type="button" variant="ghost" size="sm" onClick={() => setEditingId(null)}>
|
||||
{t("form.cancel")}
|
||||
</Button>
|
||||
{renameVocabulary.isError && (
|
||||
<p role="alert" className="text-xs text-destructive">
|
||||
{t("form.rejected")}
|
||||
</p>
|
||||
)}
|
||||
<MutationError error={renameVocabulary.error} />
|
||||
</form>
|
||||
) : (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user