chore: modify service and hanler

This commit is contained in:
riefive
2025-09-26 14:03:44 +07:00
parent 34a4fc11d0
commit 5d41e4e60d
9 changed files with 116 additions and 62 deletions
+4 -4
View File
@@ -4,7 +4,7 @@ import { ref } from 'vue'
import { type ToastFn, handleAsyncAction } from '~/handlers/_handler'
// Services
import { postSourceMaterial, patchSourceMaterial, removeSourceMaterial } from '~/services/material.service'
import { postMaterial, patchMaterial, removeMaterial } from '~/services/material.service'
const recId = ref<number>(0)
const recAction = ref<string>('')
@@ -23,7 +23,7 @@ function onResetState() {
export async function handleActionSave(values: any, refresh: () => void, reset: () => void, toast: ToastFn) {
isProcessing.value = true
await handleAsyncAction<[any], any>({
action: postSourceMaterial,
action: postMaterial,
args: [values],
toast,
successMessage: 'Data berhasil disimpan',
@@ -48,7 +48,7 @@ export async function handleActionEdit(
) {
isProcessing.value = true
await handleAsyncAction<[number | string, any], any>({
action: patchSourceMaterial,
action: patchMaterial,
args: [id, values],
toast,
successMessage: 'Data berhasil diubah',
@@ -67,7 +67,7 @@ export async function handleActionEdit(
export async function handleActionRemove(id: number | string, refresh: () => void, toast: ToastFn) {
isProcessing.value = true
await handleAsyncAction<[number | string], any>({
action: removeSourceMaterial,
action: removeMaterial,
args: [id],
toast,
successMessage: 'Data berhasil dihapus',