Skip to content

Commit

Permalink
error hndl for cf
Browse files Browse the repository at this point in the history
  • Loading branch information
ciur committed Oct 27, 2024
1 parent 7c70e5a commit eb30c71
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ import {
} from "@/features/document/apiSlice"
import {selectCurrentNodeID} from "@/features/ui/uiSlice"
import type {CFV, PanelMode} from "@/types"
import {Button, ComboboxItem, Select, Skeleton, TextInput} from "@mantine/core"
import {
Button,
ComboboxItem,
Select,
Skeleton,
Text,
TextInput
} from "@mantine/core"

export default function CustomFields() {
const mode: PanelMode = useContext(PanelContext)
Expand All @@ -35,8 +42,11 @@ export default function CustomFields() {
const [updateDocumentCustomFields, {error}] =
useUpdateDocumentCustomFieldsMutation()
const [updateDocumentType] = useUpdateDocumentTypeMutation()
const {data: documentCustomFields, isSuccess: isSuccessDocumentCustomFields} =
useGetDocumentCustomFieldsQuery(docID ?? skipToken)
const {
data: documentCustomFields,
isSuccess: isSuccessDocumentCustomFields,
isError: isErrorGetDocCF
} = useGetDocumentCustomFieldsQuery(docID ?? skipToken)

useEffect(() => {
if (documentCustomFields && documentCustomFields.length > 0) {
Expand Down Expand Up @@ -172,6 +182,11 @@ export default function CustomFields() {
clearable
/>
{genericCustomFieldsComponents}
{isErrorGetDocCF && (
<Text c="red">
Error while fetching custom fields. Error code cf98g62m.
</Text>
)}
{showSaveButton && <Button onClick={onSave}>Save</Button>}
{error && (
<div>
Expand Down

0 comments on commit eb30c71

Please sign in to comment.