mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 12:56:05 +00:00
introduced auth strategy actions to allow user creation in UI
This commit is contained in:
@@ -6,6 +6,7 @@ import { useApiQuery, useEntityQuery } from "ui/client";
|
||||
import { useBkndData } from "ui/client/schema/data/use-bknd-data";
|
||||
import { Button } from "ui/components/buttons/Button";
|
||||
import { IconButton } from "ui/components/buttons/IconButton";
|
||||
import { Message } from "ui/components/display/Message";
|
||||
import { Dropdown } from "ui/components/overlay/Dropdown";
|
||||
import { useBrowserTitle } from "ui/hooks/use-browser-title";
|
||||
import * as AppShell from "ui/layouts/AppShell/AppShell";
|
||||
@@ -18,7 +19,11 @@ import { useEntityForm } from "ui/modules/data/hooks/useEntityForm";
|
||||
|
||||
export function DataEntityUpdate({ params }) {
|
||||
const { $data, relations } = useBkndData();
|
||||
const entity = $data.entity(params.entity as string)!;
|
||||
const entity = $data.entity(params.entity as string);
|
||||
if (!entity) {
|
||||
return <Message.NotFound description={`Entity "${params.entity}" doesn't exist.`} />;
|
||||
}
|
||||
|
||||
const entityId = Number.parseInt(params.id as string);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [navigate] = useNavigate();
|
||||
@@ -36,7 +41,8 @@ export function DataEntityUpdate({ params }) {
|
||||
with: local_relation_refs
|
||||
},
|
||||
{
|
||||
revalidateOnFocus: false
|
||||
revalidateOnFocus: false,
|
||||
shouldRetryOnError: false
|
||||
}
|
||||
);
|
||||
|
||||
@@ -81,6 +87,14 @@ export function DataEntityUpdate({ params }) {
|
||||
onSubmitted
|
||||
});
|
||||
|
||||
if (!data && !$q.isLoading) {
|
||||
return (
|
||||
<Message.NotFound
|
||||
description={`Entity "${params.entity}" with ID "${entityId}" doesn't exist.`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const makeKey = (key: string | number = "") =>
|
||||
`${params.entity.name}_${entityId}_${String(key)}`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user