Fix for company logo
This commit is contained in:
parent
3385c1a156
commit
3a421a824e
|
|
@ -38,7 +38,7 @@ class SettingsRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<CompanyEntity> saveEInvoiceCertificate(Credentials credentials,
|
Future<CompanyEntity> saveEInvoiceCertificate(Credentials credentials,
|
||||||
CompanyEntity company, MultipartFile? eInvoiceCertificate) async {
|
CompanyEntity company, MultipartFile eInvoiceCertificate) async {
|
||||||
dynamic response;
|
dynamic response;
|
||||||
|
|
||||||
final url = credentials.url! + '/companies/${company.id}';
|
final url = credentials.url! + '/companies/${company.id}';
|
||||||
|
|
@ -205,7 +205,7 @@ class SettingsRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<BaseEntity> uploadLogo(Credentials credentials, String entityId,
|
Future<BaseEntity> uploadLogo(Credentials credentials, String entityId,
|
||||||
MultipartFile? multipartFile, EntityType? type) async {
|
MultipartFile multipartFile, EntityType? type) async {
|
||||||
final route = type == EntityType.company
|
final route = type == EntityType.company
|
||||||
? 'companies'
|
? 'companies'
|
||||||
: type == EntityType.group
|
: type == EntityType.group
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ class WebClient {
|
||||||
String url,
|
String url,
|
||||||
String? token, {
|
String? token, {
|
||||||
dynamic data,
|
dynamic data,
|
||||||
List<MultipartFile?>? multipartFiles,
|
List<MultipartFile>? multipartFiles,
|
||||||
String? secret,
|
String? secret,
|
||||||
String? password,
|
String? password,
|
||||||
String? idToken,
|
String? idToken,
|
||||||
|
|
@ -309,12 +309,12 @@ String _parseError(int code, String response) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<http.Response> _uploadFiles(
|
Future<http.Response> _uploadFiles(
|
||||||
String url, String? token, List<MultipartFile?> multipartFiles,
|
String url, String? token, List<MultipartFile> multipartFiles,
|
||||||
{String method = 'POST', dynamic data}) async {
|
{String method = 'POST', dynamic data}) async {
|
||||||
final request = http.MultipartRequest(method, Uri.parse(url))
|
final request = http.MultipartRequest(method, Uri.parse(url))
|
||||||
..fields.addAll(data ?? {})
|
..fields.addAll(data ?? {})
|
||||||
..headers.addAll(_getHeaders(url, token))
|
..headers.addAll(_getHeaders(url, token))
|
||||||
..files.addAll(multipartFiles as Iterable<MultipartFile>);
|
..files.addAll(multipartFiles);
|
||||||
|
|
||||||
return await http.Response.fromStream(await request.send())
|
return await http.Response.fromStream(await request.send())
|
||||||
.timeout(const Duration(minutes: 10));
|
.timeout(const Duration(minutes: 10));
|
||||||
|
|
|
||||||
|
|
@ -58,14 +58,14 @@ class SaveCompanyFailure implements StopSaving {
|
||||||
|
|
||||||
class SaveEInvoiceCertificateRequest implements StartSaving {
|
class SaveEInvoiceCertificateRequest implements StartSaving {
|
||||||
SaveEInvoiceCertificateRequest({
|
SaveEInvoiceCertificateRequest({
|
||||||
this.completer,
|
required this.completer,
|
||||||
this.company,
|
required this.company,
|
||||||
this.eInvoiceCertificate,
|
required this.eInvoiceCertificate,
|
||||||
});
|
});
|
||||||
|
|
||||||
final Completer? completer;
|
final Completer completer;
|
||||||
final CompanyEntity? company;
|
final CompanyEntity company;
|
||||||
final MultipartFile? eInvoiceCertificate;
|
final MultipartFile eInvoiceCertificate;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SaveEInvoiceCertificateSuccess
|
class SaveEInvoiceCertificateSuccess
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,10 @@ class UpdateUserSettings implements PersistUI {
|
||||||
}
|
}
|
||||||
|
|
||||||
class UploadLogoRequest implements StartSaving {
|
class UploadLogoRequest implements StartSaving {
|
||||||
UploadLogoRequest({this.completer, this.multipartFile, this.type});
|
UploadLogoRequest({this.completer, required this.multipartFile, this.type});
|
||||||
|
|
||||||
final Completer? completer;
|
final Completer? completer;
|
||||||
final MultipartFile? multipartFile;
|
final MultipartFile multipartFile;
|
||||||
final EntityType? type;
|
final EntityType? type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,16 +126,16 @@ Middleware<AppState> _saveEInvoiceCertificate(
|
||||||
settingsRepository
|
settingsRepository
|
||||||
.saveEInvoiceCertificate(
|
.saveEInvoiceCertificate(
|
||||||
store.state.credentials,
|
store.state.credentials,
|
||||||
action.company!,
|
action.company,
|
||||||
action.eInvoiceCertificate,
|
action.eInvoiceCertificate,
|
||||||
)
|
)
|
||||||
.then((company) {
|
.then((company) {
|
||||||
store.dispatch(SaveEInvoiceCertificateSuccess(company));
|
store.dispatch(SaveEInvoiceCertificateSuccess(company));
|
||||||
action.completer!.complete();
|
action.completer.complete();
|
||||||
}).catchError((Object error) {
|
}).catchError((Object error) {
|
||||||
print(error);
|
print(error);
|
||||||
store.dispatch(SaveEInvoiceCertificateFailure(error));
|
store.dispatch(SaveEInvoiceCertificateFailure(error));
|
||||||
action.completer!.completeError(error);
|
action.completer.completeError(error);
|
||||||
});
|
});
|
||||||
|
|
||||||
next(action);
|
next(action);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue