mirror of
https://github.com/foss42/apidash.git
synced 2025-06-05 10:20:44 +08:00
Show error message on import failure
This commit is contained in:
@ -47,6 +47,7 @@ class CollectionPane extends ConsumerWidget {
|
|||||||
},
|
},
|
||||||
onFileDropped: (file) {
|
onFileDropped: (file) {
|
||||||
final importFormatType = ref.read(importFormatStateProvider);
|
final importFormatType = ref.read(importFormatStateProvider);
|
||||||
|
String? msg;
|
||||||
file.readAsString().then(
|
file.readAsString().then(
|
||||||
(content) {
|
(content) {
|
||||||
kImporter
|
kImporter
|
||||||
@ -57,17 +58,18 @@ class CollectionPane extends ConsumerWidget {
|
|||||||
.read(collectionStateNotifierProvider.notifier)
|
.read(collectionStateNotifierProvider.notifier)
|
||||||
.addRequestModel(importedRequestModel);
|
.addRequestModel(importedRequestModel);
|
||||||
} else {
|
} else {
|
||||||
// TODO: show in status bar
|
msg = "Unable to parse ${file.name}";
|
||||||
debugPrint("Unable to parse ${file.name}");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (e) {
|
onError: (e) {
|
||||||
// TODO: show in status bar
|
msg = "Unable to import ${file.name}";
|
||||||
debugPrint("Unable to import ${file.name}");
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
if (msg != null) {
|
||||||
|
showTextDialog(context, content: msg);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user