Fix: refactor Kai CRUD UI to no redirect

This commit is contained in:
Hasyim Kai
2025-12-05 14:15:54 +07:00
parent 89b6163da8
commit 3e812db8eb
34 changed files with 396 additions and 353 deletions

No files matched your search

+7 -5
View File
@@ -31,14 +31,16 @@ export function useQueryCRUD(modeKey: string = 'mode', recordIdKey: string = 're
const goToEntry = (myRecord_id?: any) => {
if(myRecord_id) {
crudQueryParams.value.mode = 'entry'
crudQueryParams.value.recordId = myRecord_id
crudQueryParams.value = { mode: 'entry', recordId: myRecord_id }
} else {
crudQueryParams.value.mode = 'entry'
crudQueryParams.value.recordId = undefined
crudQueryParams.value = { mode: 'entry', recordId: undefined }
}
}
const goToDetail = (myRecord_id: string|number) => {
crudQueryParams.value = { mode: 'list', recordId: String(myRecord_id) }
}
const backToList = () => {
delete route.query[recordIdKey]
router.push({
@@ -50,7 +52,7 @@ export function useQueryCRUD(modeKey: string = 'mode', recordIdKey: string = 're
})
}
return { crudQueryParams, goToEntry, backToList }
return { crudQueryParams, goToEntry, goToDetail, backToList }
}
export function useQueryCRUDMode(key: string = 'mode') {