Patch: Throw 404 if row not found
This commit is contained in:
parent
f8fab8d51b
commit
ee6a5bffd5
2 changed files with 4 additions and 3 deletions
|
@ -286,9 +286,7 @@ module External {
|
|||
if (isNaN(id)) {
|
||||
id = decodeURIComponent(row[key]).match(/\[(.*?)\]/)?.[1]
|
||||
}
|
||||
newRow[field.foreignKey || linkTablePrimary] = breakRowIdField(
|
||||
id
|
||||
)[0]
|
||||
newRow[field.foreignKey || linkTablePrimary] = breakRowIdField(id)[0]
|
||||
}
|
||||
// many to many
|
||||
else if (field.through) {
|
||||
|
|
|
@ -37,6 +37,9 @@ export async function patch(ctx: any): Promise<any> {
|
|||
datasourceId: tableId,
|
||||
}
|
||||
)
|
||||
if (!row) {
|
||||
ctx.throw(404, "Row not found!")
|
||||
}
|
||||
ctx.status = 200
|
||||
ctx.eventEmitter &&
|
||||
ctx.eventEmitter.emitRow(`row:update`, appId, row, table)
|
||||
|
|
Loading…
Reference in a new issue