mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-10 04:08:03 -06:00
WIP - more decoupling of blocs
This commit is contained in:
@@ -12,18 +12,18 @@ class DocumentDetailsCubit extends Cubit<DocumentDetailsState> {
|
||||
|
||||
Future<void> delete(DocumentModel document) async {
|
||||
await _api.delete(document);
|
||||
emit(const DocumentDetailsState());
|
||||
}
|
||||
|
||||
Future<void> update(DocumentModel document) async {
|
||||
final updatedDocument = await _api.update(document);
|
||||
emit(DocumentDetailsState(document: updatedDocument));
|
||||
}
|
||||
|
||||
Future<void> assignAsn(DocumentModel document) async {
|
||||
if (document.archiveSerialNumber == null) {
|
||||
final int asn = await _api.findNextAsn();
|
||||
update(document.copyWith(archiveSerialNumber: asn));
|
||||
final updatedDocument =
|
||||
await _api.update(document.copyWith(archiveSerialNumber: asn));
|
||||
emit(DocumentDetailsState(document: updatedDocument));
|
||||
}
|
||||
}
|
||||
|
||||
void replaceDocument(DocumentModel document) {
|
||||
emit(DocumentDetailsState(document: document));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
part of 'document_details_cubit.dart';
|
||||
|
||||
class DocumentDetailsState with EquatableMixin {
|
||||
final DocumentModel? document;
|
||||
final DocumentModel document;
|
||||
|
||||
const DocumentDetailsState({
|
||||
this.document,
|
||||
required this.document,
|
||||
});
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user