Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
maciaszczykm committed Dec 4, 2024
1 parent 036b79a commit a1903d3
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions assets/src/components/catalog/CatalogPermissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,12 @@ export function CatalogPermissionsModal({
[writeBindings]
)

const [mutation, { loading: mutationLoading, error: mutationError }] =
useUpsertCatalogMutation({
onCompleted: () => {
refetch?.()
onClose()
},
})
const [mutation, { loading, error }] = useUpsertCatalogMutation({
onCompleted: () => {
refetch?.()
onClose()
},
})
const allowSubmit = readBindings && writeBindings

const onSubmit = useCallback(
Expand All @@ -99,6 +98,7 @@ export function CatalogPermissionsModal({
attributes: {
name: catalog.name,
author: catalog.author ?? '',
category: catalog.category,
createBindings: createBindings
?.filter(isNonNullable)
.map(bindingToBindingAttributes),
Expand All @@ -115,8 +115,7 @@ export function CatalogPermissionsModal({
[
allowSubmit,
mutation,
catalog.name,
catalog.author,
catalog,
createBindings,
readBindings,
writeBindings,
Expand Down Expand Up @@ -146,7 +145,7 @@ export function CatalogPermissionsModal({
<Button
type="submit"
disabled={!allowSubmit}
loading={mutationLoading}
loading={loading}
primary
>
Save
Expand Down Expand Up @@ -220,7 +219,7 @@ export function CatalogPermissionsModal({
</div>
</div>
)}
{mutationError && <GqlError error={mutationError} />}
{error && <GqlError error={error} />}
</div>
</Modal>
)
Expand Down

0 comments on commit a1903d3

Please sign in to comment.