From 928adff6b73f4a8129fae9751d046c86de6fe472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?An=C3=ADbal=20Svarcas?= <asvarcas@metiri.la> Date: Tue, 12 Sep 2023 09:40:30 -0300 Subject: [PATCH 1/3] Fix doc's SaveButton example --- docs/SaveButton.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/SaveButton.md b/docs/SaveButton.md index 656ebf07289..6fe49f3ffb1 100644 --- a/docs/SaveButton.md +++ b/docs/SaveButton.md @@ -21,11 +21,13 @@ import { SaveButton, Toolbar, Edit, SimpleForm, useNotify, useRedirect } from 'r const PostSaveButton = props => { const notify = useNotify(); const redirect = useRedirect(); - const onSuccess = (response) => { + const onSuccess = (values, response) => { notify(`Post "${response.data.title}" saved!`); redirect('/posts'); }; - return <SaveButton {...props} mutationOptions={{ onSuccess }} />; + return ( + <SaveButton {...props} type="button" mutationOptions={{ onSuccess }} /> + ); }; const PostEditToolbar = () => ( From 33f272c492fd33167e2b1e4245fef2175fbe72c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?An=C3=ADbal=20Svarcas?= <asvarcas@metiri.la> Date: Tue, 12 Sep 2023 13:21:24 -0300 Subject: [PATCH 2/3] Apply review --- docs/SaveButton.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/SaveButton.md b/docs/SaveButton.md index 6fe49f3ffb1..2bd0a592320 100644 --- a/docs/SaveButton.md +++ b/docs/SaveButton.md @@ -21,8 +21,8 @@ import { SaveButton, Toolbar, Edit, SimpleForm, useNotify, useRedirect } from 'r const PostSaveButton = props => { const notify = useNotify(); const redirect = useRedirect(); - const onSuccess = (values, response) => { - notify(`Post "${response.data.title}" saved!`); + const onSuccess = (data) => { + notify(`Post "${data.title}" saved!`); redirect('/posts'); }; return ( From e29a116cce9699b055b5524ab9edb586b9da4ec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?An=C3=ADbal=20Svarcas?= <asvarcas@metiri.la> Date: Tue, 12 Sep 2023 13:22:13 -0300 Subject: [PATCH 3/3] Apply review --- docs/SaveButton.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/SaveButton.md b/docs/SaveButton.md index 2bd0a592320..9cb623a6fb7 100644 --- a/docs/SaveButton.md +++ b/docs/SaveButton.md @@ -21,7 +21,7 @@ import { SaveButton, Toolbar, Edit, SimpleForm, useNotify, useRedirect } from 'r const PostSaveButton = props => { const notify = useNotify(); const redirect = useRedirect(); - const onSuccess = (data) => { + const onSuccess = data => { notify(`Post "${data.title}" saved!`); redirect('/posts'); };