fix: deletion of rows from query results

This commit is contained in:
Fabio Di Stasio 2021-04-08 21:49:38 +02:00
parent 9f5ec0276c
commit c20bff7bcb
2 changed files with 9 additions and 5 deletions

View File

@ -157,9 +157,13 @@ export default (connections) => {
ipcMain.handle('delete-table-rows', async (event, params) => {
if (params.primary) {
const idString = params.rows.map(row => typeof row[params.primary] === 'string'
? `"${row[params.primary]}"`
: row[params.primary]).join(',');
const idString = params.rows.map(row => {
const fieldName = Object.keys(row)[0].includes('.') ? `${params.table}.${params.primary}` : params.primary;
return typeof row[fieldName] === 'string'
? `"${row[fieldName]}"`
: row[fieldName];
}).join(',');
try {
const result = await connections[params.uid]

View File

@ -42,6 +42,7 @@ export default {
try {
const { status, response } = await Tables.deleteTableRows(params);
this.isQuering = false;
if (status === 'success')
this.reloadTable();
@ -50,9 +51,8 @@ export default {
}
catch (err) {
this.addNotification({ status: 'error', message: err.stack });
this.isQuering = false;
}
this.isQuering = false;
}
}
};