added auth to pictrs upload

This commit is contained in:
krawieck 2020-12-04 23:26:47 +01:00
parent c3914d1484
commit 579d613caa
1 changed files with 4 additions and 2 deletions

View File

@ -79,13 +79,15 @@ class CreatePost extends HookWidget {
if (pic != null) {
imageUploadLoading.value = true;
final token = accStore.defaultTokenFor(selectedInstance.value);
final pictrs = LemmyApi(selectedInstance.value).pictrs;
final upload = await pictrs.upload(pic.path);
final upload =
await pictrs.upload(filePath: pic.path, auth: token.raw);
pictrsDeleteToken.value = upload.files[0];
urlController.text =
pathToPictrs(selectedInstance.value, upload.files[0].file);
}
print(urlController.text);
// ignore: avoid_catches_without_on_clauses
} catch (e) {
scaffoldKey.currentState