muffin-admin 3.2.1 → 3.2.2
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button, useListContext, useRecordContext } from "react-admin"
|
|
1
|
+
import { Button, useListContext, useRecordContext, useResourceContext } from "react-admin"
|
|
2
2
|
|
|
3
3
|
import { useState } from "react"
|
|
4
4
|
import { useAction } from "../hooks/useAction"
|
|
@@ -8,9 +8,10 @@ import { buildIcon, findBuilder } from "../utils"
|
|
|
8
8
|
export function ActionButton({ icon, label, title, action, id }: AdminAction) {
|
|
9
9
|
const [payloadActive, setPayloadActive] = useState(false)
|
|
10
10
|
const record = useRecordContext()
|
|
11
|
+
const resource = useResourceContext()
|
|
11
12
|
const { mutate, isLoading } = useAction(action, {})
|
|
12
13
|
|
|
13
|
-
const PayloadBuilder = findBuilder(["action", "payload", id])
|
|
14
|
+
const PayloadBuilder = findBuilder(["action", "payload", id, resource])
|
|
14
15
|
|
|
15
16
|
return (
|
|
16
17
|
<>
|
|
@@ -36,9 +37,10 @@ export function ActionButton({ icon, label, title, action, id }: AdminAction) {
|
|
|
36
37
|
export function BulkActionButton({ label, icon, title, action, id }: AdminAction) {
|
|
37
38
|
const { selectedIds } = useListContext()
|
|
38
39
|
const { mutate, isLoading } = useAction(action)
|
|
40
|
+
const resource = useResourceContext()
|
|
39
41
|
const [payloadActive, setPayloadActive] = useState(false)
|
|
40
42
|
|
|
41
|
-
const PayloadBuilder = findBuilder(["action", "payload", id])
|
|
43
|
+
const PayloadBuilder = findBuilder(["action", "payload", id, resource])
|
|
42
44
|
|
|
43
45
|
return (
|
|
44
46
|
<>
|