Fixed login and error handling

This commit is contained in:
Anton Stubenbord
2022-12-30 01:28:43 +01:00
parent bf0e186646
commit 2326c9d1d6
43 changed files with 502 additions and 447 deletions

View File

@@ -58,10 +58,6 @@ class DocumentUploadCubit extends Cubit<DocumentUploadState> {
Iterable<int> tags = const [],
DateTime? createdAt,
}) async {
final auth = await _localVault.loadAuthenticationInformation();
if (auth == null || !auth.isValid) {
throw const PaperlessServerException(ErrorCode.notAuthenticated);
}
await _documentApi.create(
bytes,
filename: filename,

View File

@@ -245,8 +245,8 @@ class _DocumentUploadPreparationPageState
Navigator.pop(context, true);
} on PaperlessServerException catch (error, stackTrace) {
showErrorMessage(context, error, stackTrace);
} on PaperlessValidationErrors catch (PaperlessServerExceptions) {
setState(() => _errors = PaperlessServerExceptions);
} on PaperlessValidationErrors catch (errors) {
setState(() => _errors = errors);
} catch (unknownError, stackTrace) {
showErrorMessage(
context, const PaperlessServerException.unknown(), stackTrace);