fix(medusa, admin-ui): Add deleted_at to Return Reason unique constraint (#4834)
* Update return reason create to upsert * Create strange-wombats-invite.md * Revert upsert, make value index only apply on non-deleted entities
This commit is contained in:
@@ -36,27 +36,22 @@ const CreateReturnReasonModal = ({
|
||||
},
|
||||
})
|
||||
const notification = useNotification()
|
||||
const { mutate, isLoading } = useAdminCreateReturnReason()
|
||||
const { mutateAsync, isLoading } = useAdminCreateReturnReason()
|
||||
|
||||
const onCreate = (data: CreateReturnReasonFormData) => {
|
||||
mutate(
|
||||
{
|
||||
const onCreate = async (data: CreateReturnReasonFormData) => {
|
||||
try {
|
||||
await mutateAsync({
|
||||
...data,
|
||||
description: data.description || undefined,
|
||||
},
|
||||
{
|
||||
onSuccess: () => {
|
||||
notification("Success", "Created a new return reason", "success")
|
||||
},
|
||||
onError: () => {
|
||||
notification(
|
||||
"Error",
|
||||
"Cant create a Return reason with an existing code",
|
||||
"error"
|
||||
)
|
||||
},
|
||||
}
|
||||
)
|
||||
})
|
||||
notification("Success", "Created a new return reason", "success")
|
||||
} catch {
|
||||
notification(
|
||||
"Error",
|
||||
"Cannot create a return reason with an existing value",
|
||||
"error"
|
||||
)
|
||||
}
|
||||
handleClose()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user