@panneau/medias 3.0.211 → 3.0.212

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/index.js CHANGED
@@ -1029,6 +1029,9 @@ function MediasBrowser(_ref) {
1029
1029
  reload();
1030
1030
  }
1031
1031
  }, [reload]);
1032
+ var onTrashMedia = useCallback(function (id) {
1033
+ return !showTrashed && withTrash ? mediaTrash(id).then(reload)["catch"](reload) : mediaDelete(id).then(reload)["catch"](reload);
1034
+ }, [showTrashed, withTrash, mediaTrash, mediaDelete, reload]);
1032
1035
  var _useState7 = useState(null),
1033
1036
  _useState8 = _slicedToArray(_useState7, 2),
1034
1037
  uploadedMedias = _useState8[0],
@@ -1279,12 +1282,12 @@ function MediasBrowser(_ref) {
1279
1282
  id = _ref10$id === void 0 ? null : _ref10$id;
1280
1283
  return _objectSpread({
1281
1284
  href: null,
1282
- withConfirmation: true,
1285
+ withConfirmation: !withTrash,
1283
1286
  disabled: trashing || deleting,
1284
1287
  icon: showTrashed ? 'trash-fill' : 'trash'
1285
1288
  }, withTrash ? {
1286
1289
  onClick: function onClick() {
1287
- return !showTrashed && withTrash ? mediaTrash(id) : mediaDelete(id);
1290
+ return onTrashMedia(id);
1288
1291
  }
1289
1292
  } : null);
1290
1293
  },
package/lib/index.js CHANGED
@@ -1031,6 +1031,9 @@ function MediasBrowser(_ref) {
1031
1031
  reload();
1032
1032
  }
1033
1033
  }, [reload]);
1034
+ var onTrashMedia = React.useCallback(function (id) {
1035
+ return !showTrashed && withTrash ? mediaTrash(id).then(reload)["catch"](reload) : mediaDelete(id).then(reload)["catch"](reload);
1036
+ }, [showTrashed, withTrash, mediaTrash, mediaDelete, reload]);
1034
1037
  var _useState7 = React.useState(null),
1035
1038
  _useState8 = _slicedToArray(_useState7, 2),
1036
1039
  uploadedMedias = _useState8[0],
@@ -1281,12 +1284,12 @@ function MediasBrowser(_ref) {
1281
1284
  id = _ref10$id === void 0 ? null : _ref10$id;
1282
1285
  return _objectSpread({
1283
1286
  href: null,
1284
- withConfirmation: true,
1287
+ withConfirmation: !withTrash,
1285
1288
  disabled: trashing || deleting,
1286
1289
  icon: showTrashed ? 'trash-fill' : 'trash'
1287
1290
  }, withTrash ? {
1288
1291
  onClick: function onClick() {
1289
- return !showTrashed && withTrash ? mediaTrash(id) : mediaDelete(id);
1292
+ return onTrashMedia(id);
1290
1293
  }
1291
1294
  } : null);
1292
1295
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/medias",
3
- "version": "3.0.211",
3
+ "version": "3.0.212",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "gitHead": "852b4a2eb4644413197a8f91739cf74f42b039f4"
72
+ "gitHead": "b9f002d844c6d4007c25a7c93fa54ba1989e6d40"
73
73
  }