diff --git a/src/components/ServerNotices.js b/src/components/ServerNotices.js index 751bada..92e55f6 100644 --- a/src/components/ServerNotices.js +++ b/src/components/ServerNotices.js @@ -50,7 +50,7 @@ const ServerNoticeDialog = ({ open, loading, onClose, onSend }) => { } redirect={false} - save={onSend} + onSubmit={onSend} > { const record = useRecordContext(); const [open, setOpen] = useState(false); const notify = useNotify(); - const [create, { isloading }] = useCreate("servernotices"); + const [create, { isloading }] = useCreate(); const handleDialogOpen = () => setOpen(true); const handleDialogClose = () => setOpen(false); const handleSend = values => { create( - { payload: { data: { id: record.id, ...values } } }, + "servernotices", + { data: { id: record.id, ...values } }, { onSuccess: () => { notify("resources.servernotices.action.send_success"); diff --git a/src/components/destinations.js b/src/components/destinations.js index 1a734a9..0190375 100644 --- a/src/components/destinations.js +++ b/src/components/destinations.js @@ -53,7 +53,7 @@ export const DestinationReconnectButton = props => { const record = useRecordContext(); const refresh = useRefresh(); const notify = useNotify(); - const [handleReconnect, { isLoading }] = useDelete("destinations"); + const [handleReconnect, { isLoading }] = useDelete(); // Reconnect is not required if no error has occurred. (`failure_ts`) if (!record || !record.failure_ts) return null; @@ -63,7 +63,8 @@ export const DestinationReconnectButton = props => { e.stopPropagation(); handleReconnect( - { payload: { id: record.id } }, + "destinations", + { id: record.id }, { onSuccess: () => { notify("ra.notification.updated", { diff --git a/src/components/devices.js b/src/components/devices.js index 0ead86d..e467c39 100644 --- a/src/components/devices.js +++ b/src/components/devices.js @@ -17,7 +17,7 @@ export const DeviceRemoveButton = props => { const refresh = useRefresh(); const notify = useNotify(); - const [removeDevice, { isLoading }] = useDelete("devices"); + const [removeDevice, { isLoading }] = useDelete(); if (!record) return null; @@ -26,7 +26,8 @@ export const DeviceRemoveButton = props => { const handleConfirm = () => { removeDevice( - { payload: { id: record.id, user_id: record.user_id } }, + "devices", + { id: record.id, meta: { user_id: record.user_id } }, { onSuccess: () => { notify("resources.devices.action.erase.success"); diff --git a/src/components/media.js b/src/components/media.js index 4e7a488..fde870f 100644 --- a/src/components/media.js +++ b/src/components/media.js @@ -97,14 +97,15 @@ export const DeleteMediaButton = props => { const theme = useTheme(); const [open, setOpen] = useState(false); const notify = useNotify(); - const [deleteOne, { isLoading }] = useDelete("delete_media"); + const [deleteOne, { isLoading }] = useDelete(); const handleDialogOpen = () => setOpen(true); const handleDialogClose = () => setOpen(false); const handleSend = values => { deleteOne( - { payload: { ...values } }, + "delete_media", + { id: values.id }, { onSuccess: () => { notify("resources.delete_media.action.send_success"); @@ -151,14 +152,15 @@ export const ProtectMediaButton = props => { const translate = useTranslate(); const refresh = useRefresh(); const notify = useNotify(); - const [create, { loading }] = useCreate("protect_media"); - const [deleteOne] = useDelete("protect_media"); + const [create, { isLoading }] = useCreate(); + const [deleteOne] = useDelete(); if (!record) return null; const handleProtect = () => { create( - { payload: { data: record } }, + "protect_media", + { data: record }, { onSuccess: () => { notify("resources.protect_media.action.send_success"); @@ -174,7 +176,8 @@ export const ProtectMediaButton = props => { const handleUnprotect = () => { deleteOne( - { payload: { ...record } }, + "protect_media", + { id: record.id }, { onSuccess: () => { notify("resources.protect_media.action.send_success"); @@ -219,7 +222,7 @@ export const ProtectMediaButton = props => { arrow >
-
@@ -232,7 +235,7 @@ export const ProtectMediaButton = props => { })} >
-
@@ -247,14 +250,15 @@ export const QuarantineMediaButton = props => { const translate = useTranslate(); const refresh = useRefresh(); const notify = useNotify(); - const [create, { loading }] = useCreate("quarantine_media"); - const [deleteOne] = useDelete("quarantine_media"); + const [create, { isLoading }] = useCreate(); + const [deleteOne] = useDelete(); if (!record) return null; const handleQuarantaine = () => { create( - { payload: { data: record } }, + "quarantine_media", + { data: record }, { onSuccess: () => { notify("resources.quarantine_media.action.send_success"); @@ -270,7 +274,8 @@ export const QuarantineMediaButton = props => { const handleRemoveQuarantaine = () => { deleteOne( - { payload: { ...record } }, + "quarantine_media", + { id: record.id }, { onSuccess: () => { notify("resources.quarantine_media.action.send_success"); @@ -306,7 +311,7 @@ export const QuarantineMediaButton = props => { })} >
-
@@ -319,7 +324,7 @@ export const QuarantineMediaButton = props => { })} >
-
diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index db57ec7..39e099a 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -98,7 +98,7 @@ const resourceMap = { }), delete: params => ({ endpoint: `/_synapse/admin/v2/users/${encodeURIComponent( - params.user_id + params.meta.user_id )}/devices/${params.id}`, }), }, @@ -184,9 +184,9 @@ const resourceMap = { delete: params => ({ endpoint: `/_synapse/admin/v1/media/${localStorage.getItem( "home_server" - )}/delete?before_ts=${params.before_ts}&size_gt=${ - params.size_gt - }&keep_profiles=${params.keep_profiles}`, + )}/delete?before_ts=${params.meta.before_ts}&size_gt=${ + params.meta.size_gt + }&keep_profiles=${params.meta.keep_profiles}`, method: "POST", }), }, @@ -197,7 +197,7 @@ const resourceMap = { method: "POST", }), delete: params => ({ - endpoint: `/_synapse/admin/v1/media/unprotect/${params.media_id}`, + endpoint: `/_synapse/admin/v1/media/unprotect/${params.id}`, method: "POST", }), }, @@ -212,7 +212,7 @@ const resourceMap = { delete: params => ({ endpoint: `/_synapse/admin/v1/media/unquarantine/${localStorage.getItem( "home_server" - )}/${params.media_id}`, + )}/${params.id}`, method: "POST", }), },