Added confirmation before table deletion

This commit is contained in:
Andrew 2023-05-08 13:04:05 +07:00
parent a01a66c88d
commit 12ff1e953a

View file

@ -68,6 +68,31 @@ class TablesListPanelController extends GetxController {
} }
Future<void> deleteTable(TableDefinition table) async { Future<void> deleteTable(TableDefinition table) async {
final accept = await Get.dialog<bool>(
AlertDialog(
title: const Text("Delete table"),
content: Text(
"Are you sure you want to delete ${table.tableName.pascalCase}?",
),
actions: [
TextButton(
onPressed: () {
Get.back(result: false);
},
child: const Text("Cancel"),
),
TextButton(
onPressed: () {
Get.back(result: true);
},
child: const Text("Delete"),
),
],
),
);
if (accept != true) return;
try { try {
final resp = await ApiController.to.apiClient.dropTable( final resp = await ApiController.to.apiClient.dropTable(
tableName: table.tableName, tableName: table.tableName,