Redirect to detail view of newly created record
This commit is contained in:
@@ -308,12 +308,13 @@ export const useViewState = <T extends { id?: string }>(
|
||||
}
|
||||
|
||||
const handleSave = async (data: T) => {
|
||||
let savedRecord
|
||||
if (data.id) {
|
||||
await updateRecord(data.id, data)
|
||||
savedRecord = await updateRecord(data.id, data)
|
||||
} else {
|
||||
await createRecord(data)
|
||||
savedRecord = await createRecord(data)
|
||||
}
|
||||
showDetail(currentRecord.value!)
|
||||
return savedRecord
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user