@visns-studio/visns-components 5.4.0 → 5.4.1

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/package.json CHANGED
@@ -78,7 +78,7 @@
78
78
  "react-dom": "^17.0.0 || ^18.0.0"
79
79
  },
80
80
  "name": "@visns-studio/visns-components",
81
- "version": "5.4.0",
81
+ "version": "5.4.1",
82
82
  "description": "Various packages to assist in the development of our Custom Applications.",
83
83
  "main": "src/index.js",
84
84
  "files": [
@@ -296,6 +296,29 @@ function GenericDetail({
296
296
  window.open(exportUrl);
297
297
  };
298
298
 
299
+ const handleCustomAction = async (action) => {
300
+ try {
301
+ if (action.url) {
302
+ const res = await CustomFetch(
303
+ action.url,
304
+ action.method || 'POST',
305
+ {
306
+ id: routeParams[urlParam],
307
+ ...action.payload,
308
+ }
309
+ );
310
+
311
+ if (res.data.error === '') {
312
+ toast.success(action.message);
313
+ } else {
314
+ toast.error(res.data.error);
315
+ }
316
+ }
317
+ } catch (error) {
318
+ console.error(error);
319
+ }
320
+ };
321
+
299
322
  const handleCheckboxUpdate = async () => {
300
323
  try {
301
324
  if (currentConfigRef.current.functions.checkboxUpdate) {
@@ -1707,6 +1730,22 @@ function GenericDetail({
1707
1730
  Export
1708
1731
  </button>
1709
1732
  )}
1733
+
1734
+ {activeTabConfig.customAction && (
1735
+ <button
1736
+ className={styles.btn}
1737
+ onClick={() =>
1738
+ handleCustomAction(
1739
+ activeTabConfig.customAction
1740
+ )
1741
+ }
1742
+ >
1743
+ {
1744
+ activeTabConfig
1745
+ .customAction.label
1746
+ }
1747
+ </button>
1748
+ )}
1710
1749
  </div>
1711
1750
  )}
1712
1751
  </>