feat(web): inline status-aware errors on term/authority edit rows + delete dialog (#63)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { InUseError } from "../api/queries";
|
||||
import { errorMessageKey } from "../api/error-message";
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogTrigger,
|
||||
@@ -37,7 +37,8 @@ export function DeleteConfirmDialog({
|
||||
} catch (err) {
|
||||
// Keep the dialog open; show the blocking reason. Never let the rejected
|
||||
// mutation escape as an unhandled rejection.
|
||||
setMessage(err instanceof InUseError ? t("actions.inUse", { count: err.count }) : t("form.rejected"));
|
||||
const { key, opts } = errorMessageKey(err);
|
||||
setMessage(t(key, opts));
|
||||
return;
|
||||
}
|
||||
setOpen(false);
|
||||
|
||||
Reference in New Issue
Block a user