once again
This commit is contained in:
parent
b6b58e8895
commit
ef516ce396
|
@ -106,16 +106,15 @@ Future<void> _postOnMastodon(reqJson) async {
|
|||
options:
|
||||
dio_lib.Options(headers: {'Authorization': 'Bearer $authToken'}));
|
||||
} else {
|
||||
final mediaResponses = await photoUrls.map((photoUrl) async => await dio.post(
|
||||
'$instanceUrl/api/v1/media',
|
||||
var mediaIds = [];
|
||||
|
||||
for (final photoUrl in photoUrls) {
|
||||
final resp = await dio.post('$instanceUrl/api/v1/media',
|
||||
data: dio_lib.FormData.fromMap({'file': File(photoUrl)}),
|
||||
options:
|
||||
dio_lib.Options(headers: {'Authorization': 'Bearer $authToken'})));
|
||||
|
||||
final mediaIds = mediaResponses.map((mediaResponse) {
|
||||
final mediaId = mediaResponse.data['id'];
|
||||
return mediaId;
|
||||
}).toList();
|
||||
dio_lib.Options(headers: {'Authorization': 'Bearer $authToken'}));
|
||||
mediaIds.add(resp.data['id']);
|
||||
}
|
||||
|
||||
await dio.post('$instanceUrl/api/v1/statuses',
|
||||
data: {'status': postText, 'media_ids': mediaIds},
|
||||
|
|
Loading…
Reference in a new issue