refactor: remove unused permission check in ProductVariantEditModal to streamline submission process
This commit is contained in:
parent
814814f1a5
commit
c78afb6477
@ -17,7 +17,6 @@ import {
|
|||||||
} from '@/components/ui/dialog';
|
} from '@/components/ui/dialog';
|
||||||
import { Field, FieldError, FieldLabel, FieldGroup, FieldSet } from '@/components/ui/field';
|
import { Field, FieldError, FieldLabel, FieldGroup, FieldSet } from '@/components/ui/field';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { useCan } from '@/composables/useCan';
|
|
||||||
import { useFormDialog } from '@/composables/useFormDialog';
|
import { useFormDialog } from '@/composables/useFormDialog';
|
||||||
import { formErrors } from '@/lib/form';
|
import { formErrors } from '@/lib/form';
|
||||||
import { update } from '@/routes/admin/master/products';
|
import { update } from '@/routes/admin/master/products';
|
||||||
@ -145,19 +144,10 @@ function submit() {
|
|||||||
appendMediaToFormData(formData, `variants[${index}]`, v.media);
|
appendMediaToFormData(formData, `variants[${index}]`, v.media);
|
||||||
});
|
});
|
||||||
|
|
||||||
const { can } = useCan();
|
|
||||||
const isOwner = can('owner_verifications.verify');
|
|
||||||
|
|
||||||
editForm.transform(() => formData).post(update.url(props.product.id), {
|
editForm.transform(() => formData).post(update.url(props.product.id), {
|
||||||
forceFormData: true,
|
forceFormData: true,
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
open.value = false;
|
open.value = false;
|
||||||
|
|
||||||
if (isOwner) {
|
|
||||||
toast.success('Varian produk berhasil diperbarui.');
|
|
||||||
} else {
|
|
||||||
toast.success('Perubahan varian berhasil diajukan dan menunggu verifikasi owner.');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onError: (errors) => {
|
onError: (errors) => {
|
||||||
if (errors.system) {
|
if (errors.system) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user