{"action":"created","comment":{"url":"https://api.github.com/repos/entando/app-builder/pulls/comments/189946060","pull_request_review_id":122224096,"id":189946060,"diff_hunk":"@@ -142,45 +151,41 @@ export const initPageModelForm = () => (dispatch, getState) => {\n   });\n };\n \n-export const updatePageModel = pageModel => (dispatch, getState) => {\n-  const toSend = pageModel || getFormPageModel(getState());\n-  return new Promise((resolve) => {\n-    if (toSend) {\n-      putPageModel(toSend).then((response) => {\n-        if (!response.ok) {\n-          response.json().then((data) => {\n-            dispatch(addErrors(data.errors.map(err => err.message)));\n-            resolve();\n-          });\n-        } else {\n-          resolve();\n-        }\n+export const updatePageModel = pageModel => dispatch => new Promise((resolve) => {\n+  putPageModel(pageModel).then((response) => {\n+    if (!response.ok) {\n+      response.json().then((data) => {\n+        dispatch(addErrors(data.errors.map(err => err.message)));\n+        resolve();\n       });\n     } else {\n+      dispatch(addToast(\n+        formattedText('app.updated', null, { type: 'page model', code: pageModel.code }),\n+        TOAST_SUCCESS,\n+      ));\n+      gotoRoute(ROUTE_PAGE_MODEL_LIST);\n       resolve();\n     }\n   });\n-};\n+});\n \n-export const createPageModel = pageModel => (dispatch, getState) => {\n-  const toSend = pageModel || getFormPageModel(getState());\n-  return new Promise((resolve) => {\n-    if (toSend) {\n-      postPageModel(toSend).then((response) => {\n-        if (!response.ok) {\n-          response.json().then((data) => {\n-            dispatch(addErrors(data.errors.map(err => err.message)));\n-            resolve();\n-          });\n-        } else {\n-          resolve();\n-        }\n+export const createPageModel = pageModel => dispatch => new Promise((resolve) => {\n+  postPageModel(pageModel).then((response) => {\n+    if (!response.ok) {\n+      response.json().then((data) => {\n+        dispatch(addErrors(data.errors.map(err => err.message)));\n+        resolve();","path":"src/state/page-models/actions.js","position":93,"original_position":93,"commit_id":"566ed46fbc55cd9beaa67be8fd7b9824c5e78ac6","original_commit_id":"566ed46fbc55cd9beaa67be8fd7b9824c5e78ac6","user":{"login":"fedelocci","id":12064327,"avatar_url":"https://avatars0.githubusercontent.com/u/12064327?v=4","gravatar_id":"","url":"https://api.github.com/users/fedelocci","html_url":"https://github.com/fedelocci","followers_url":"https://api.github.com/users/fedelocci/followers","following_url":"https://api.github.com/users/fedelocci/following{/other_user}","gists_url":"https://api.github.com/users/fedelocci/gists{/gist_id}","starred_url":"https://api.github.com/users/fedelocci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedelocci/subscriptions","organizations_url":"https://api.github.com/users/fedelocci/orgs","repos_url":"https://api.github.com/users/fedelocci/repos","events_url":"https://api.github.com/users/fedelocci/events{/privacy}","received_events_url":"https://api.github.com/users/fedelocci/received_events","type":"User","site_admin":false},"body":"you can remove this. You can call resolve after else","created_at":"2018-05-22T15:26:39Z","updated_at":"2018-05-22T15:28:01Z","html_url":"https://github.com/entando/app-builder/pull/201#discussion_r189946060","pull_request_url":"https://api.github.com/repos/entando/app-builder/pulls/201","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/entando/app-builder/pulls/comments/189946060"},"html":{"href":"https://github.com/entando/app-builder/pull/201#discussion_r189946060"},"pull_request":{"href":"https://api.github.com/repos/entando/app-builder/pulls/201"}}},"pull_request":{"url":"https://api.github.com/repos/entando/app-builder/pulls/201","id":189681567,"html_url":"https://github.com/entando/app-builder/pull/201","diff_url":"https://github.com/entando/app-builder/pull/201.diff","patch_url":"https://github.com/entando/app-builder/pull/201.patch","issue_url":"https://api.github.com/repos/entando/app-builder/issues/201","number":201,"state":"open","locked":false,"title":"page models toasts","user":{"login":"nicpuddu","id":28562595,"avatar_url":"https://avatars2.githubusercontent.com/u/28562595?v=4","gravatar_id":"","url":"https://api.github.com/users/nicpuddu","html_url":"https://github.com/nicpuddu","followers_url":"https://api.github.com/users/nicpuddu/followers","following_url":"https://api.github.com/users/nicpuddu/following{/other_user}","gists_url":"https://api.github.com/users/nicpuddu/gists{/gist_id}","starred_url":"https://api.github.com/users/nicpuddu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicpuddu/subscriptions","organizations_url":"https://api.github.com/users/nicpuddu/orgs","repos_url":"https://api.github.com/users/nicpuddu/repos","events_url":"https://api.github.com/users/nicpuddu/events{/privacy}","received_events_url":"https://api.github.com/users/nicpuddu/received_events","type":"User","site_admin":false},"body":"fixed also redirect bug when the update or creation would error","created_at":"2018-05-22T14:24:51Z","updated_at":"2018-05-22T15:28:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5dc3f4d8750cefe4c3b197ee46f9c6abfe887b03","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/entando/app-builder/pulls/201/commits","review_comments_url":"https://api.github.com/repos/entando/app-builder/pulls/201/comments","review_comment_url":"https://api.github.com/repos/entando/app-builder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/entando/app-builder/issues/201/comments","statuses_url":"https://api.github.com/repos/entando/app-builder/statuses/566ed46fbc55cd9beaa67be8fd7b9824c5e78ac6","head":{"label":"entando:EN-1475-page-models-delete","ref":"EN-1475-page-models-delete","sha":"566ed46fbc55cd9beaa67be8fd7b9824c5e78ac6","user":{"login":"entando","id":673103,"avatar_url":"https://avatars2.githubusercontent.com/u/673103?v=4","gravatar_id":"","url":"https://api.github.com/users/entando","html_url":"https://github.com/entando","followers_url":"https://api.github.com/users/entando/followers","following_url":"https://api.github.com/users/entando/following{/other_user}","gists_url":"https://api.github.com/users/entando/gists{/gist_id}","starred_url":"https://api.github.com/users/entando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/entando/subscriptions","organizations_url":"https://api.github.com/users/entando/orgs","repos_url":"https://api.github.com/users/entando/repos","events_url":"https://api.github.com/users/entando/events{/privacy}","received_events_url":"https://api.github.com/users/entando/received_events","type":"Organization","site_admin":false},"repo":{"id":118141962,"name":"app-builder","full_name":"entando/app-builder","owner":{"login":"entando","id":673103,"avatar_url":"https://avatars2.githubusercontent.com/u/673103?v=4","gravatar_id":"","url":"https://api.github.com/users/entando","html_url":"https://github.com/entando","followers_url":"https://api.github.com/users/entando/followers","following_url":"https://api.github.com/users/entando/following{/other_user}","gists_url":"https://api.github.com/users/entando/gists{/gist_id}","starred_url":"https://api.github.com/users/entando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/entando/subscriptions","organizations_url":"https://api.github.com/users/entando/orgs","repos_url":"https://api.github.com/users/entando/repos","events_url":"https://api.github.com/users/entando/events{/privacy}","received_events_url":"https://api.github.com/users/entando/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/entando/app-builder","description":"The Entando app-builder","fork":false,"url":"https://api.github.com/repos/entando/app-builder","forks_url":"https://api.github.com/repos/entando/app-builder/forks","keys_url":"https://api.github.com/repos/entando/app-builder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/entando/app-builder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/entando/app-builder/teams","hooks_url":"https://api.github.com/repos/entando/app-builder/hooks","issue_events_url":"https://api.github.com/repos/entando/app-builder/issues/events{/number}","events_url":"https://api.github.com/repos/entando/app-builder/events","assignees_url":"https://api.github.com/repos/entando/app-builder/assignees{/user}","branches_url":"https://api.github.com/repos/entando/app-builder/branches{/branch}","tags_url":"https://api.github.com/repos/entando/app-builder/tags","blobs_url":"https://api.github.com/repos/entando/app-builder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/entando/app-builder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/entando/app-builder/git/refs{/sha}","trees_url":"https://api.github.com/repos/entando/app-builder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/entando/app-builder/statuses/{sha}","languages_url":"https://api.github.com/repos/entando/app-builder/languages","stargazers_url":"https://api.github.com/repos/entando/app-builder/stargazers","contributors_url":"https://api.github.com/repos/entando/app-builder/contributors","subscribers_url":"https://api.github.com/repos/entando/app-builder/subscribers","subscription_url":"https://api.github.com/repos/entando/app-builder/subscription","commits_url":"https://api.github.com/repos/entando/app-builder/commits{/sha}","git_commits_url":"https://api.github.com/repos/entando/app-builder/git/commits{/sha}","comments_url":"https://api.github.com/repos/entando/app-builder/comments{/number}","issue_comment_url":"https://api.github.com/repos/entando/app-builder/issues/comments{/number}","contents_url":"https://api.github.com/repos/entando/app-builder/contents/{+path}","compare_url":"https://api.github.com/repos/entando/app-builder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/entando/app-builder/merges","archive_url":"https://api.github.com/repos/entando/app-builder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/entando/app-builder/downloads","issues_url":"https://api.github.com/repos/entando/app-builder/issues{/number}","pulls_url":"https://api.github.com/repos/entando/app-builder/pulls{/number}","milestones_url":"https://api.github.com/repos/entando/app-builder/milestones{/number}","notifications_url":"https://api.github.com/repos/entando/app-builder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/entando/app-builder/labels{/name}","releases_url":"https://api.github.com/repos/entando/app-builder/releases{/id}","deployments_url":"https://api.github.com/repos/entando/app-builder/deployments","created_at":"2018-01-19T15:25:13Z","updated_at":"2018-05-22T15:23:01Z","pushed_at":"2018-05-22T15:25:05Z","git_url":"git://github.com/entando/app-builder.git","ssh_url":"git@github.com:entando/app-builder.git","clone_url":"https://github.com/entando/app-builder.git","svn_url":"https://github.com/entando/app-builder","homepage":"","size":2046,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":1,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"entando:master","ref":"master","sha":"720b786f64593f244cfcc5e22d9b9faf35452435","user":{"login":"entando","id":673103,"avatar_url":"https://avatars2.githubusercontent.com/u/673103?v=4","gravatar_id":"","url":"https://api.github.com/users/entando","html_url":"https://github.com/entando","followers_url":"https://api.github.com/users/entando/followers","following_url":"https://api.github.com/users/entando/following{/other_user}","gists_url":"https://api.github.com/users/entando/gists{/gist_id}","starred_url":"https://api.github.com/users/entando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/entando/subscriptions","organizations_url":"https://api.github.com/users/entando/orgs","repos_url":"https://api.github.com/users/entando/repos","events_url":"https://api.github.com/users/entando/events{/privacy}","received_events_url":"https://api.github.com/users/entando/received_events","type":"Organization","site_admin":false},"repo":{"id":118141962,"name":"app-builder","full_name":"entando/app-builder","owner":{"login":"entando","id":673103,"avatar_url":"https://avatars2.githubusercontent.com/u/673103?v=4","gravatar_id":"","url":"https://api.github.com/users/entando","html_url":"https://github.com/entando","followers_url":"https://api.github.com/users/entando/followers","following_url":"https://api.github.com/users/entando/following{/other_user}","gists_url":"https://api.github.com/users/entando/gists{/gist_id}","starred_url":"https://api.github.com/users/entando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/entando/subscriptions","organizations_url":"https://api.github.com/users/entando/orgs","repos_url":"https://api.github.com/users/entando/repos","events_url":"https://api.github.com/users/entando/events{/privacy}","received_events_url":"https://api.github.com/users/entando/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/entando/app-builder","description":"The Entando app-builder","fork":false,"url":"https://api.github.com/repos/entando/app-builder","forks_url":"https://api.github.com/repos/entando/app-builder/forks","keys_url":"https://api.github.com/repos/entando/app-builder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/entando/app-builder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/entando/app-builder/teams","hooks_url":"https://api.github.com/repos/entando/app-builder/hooks","issue_events_url":"https://api.github.com/repos/entando/app-builder/issues/events{/number}","events_url":"https://api.github.com/repos/entando/app-builder/events","assignees_url":"https://api.github.com/repos/entando/app-builder/assignees{/user}","branches_url":"https://api.github.com/repos/entando/app-builder/branches{/branch}","tags_url":"https://api.github.com/repos/entando/app-builder/tags","blobs_url":"https://api.github.com/repos/entando/app-builder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/entando/app-builder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/entando/app-builder/git/refs{/sha}","trees_url":"https://api.github.com/repos/entando/app-builder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/entando/app-builder/statuses/{sha}","languages_url":"https://api.github.com/repos/entando/app-builder/languages","stargazers_url":"https://api.github.com/repos/entando/app-builder/stargazers","contributors_url":"https://api.github.com/repos/entando/app-builder/contributors","subscribers_url":"https://api.github.com/repos/entando/app-builder/subscribers","subscription_url":"https://api.github.com/repos/entando/app-builder/subscription","commits_url":"https://api.github.com/repos/entando/app-builder/commits{/sha}","git_commits_url":"https://api.github.com/repos/entando/app-builder/git/commits{/sha}","comments_url":"https://api.github.com/repos/entando/app-builder/comments{/number}","issue_comment_url":"https://api.github.com/repos/entando/app-builder/issues/comments{/number}","contents_url":"https://api.github.com/repos/entando/app-builder/contents/{+path}","compare_url":"https://api.github.com/repos/entando/app-builder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/entando/app-builder/merges","archive_url":"https://api.github.com/repos/entando/app-builder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/entando/app-builder/downloads","issues_url":"https://api.github.com/repos/entando/app-builder/issues{/number}","pulls_url":"https://api.github.com/repos/entando/app-builder/pulls{/number}","milestones_url":"https://api.github.com/repos/entando/app-builder/milestones{/number}","notifications_url":"https://api.github.com/repos/entando/app-builder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/entando/app-builder/labels{/name}","releases_url":"https://api.github.com/repos/entando/app-builder/releases{/id}","deployments_url":"https://api.github.com/repos/entando/app-builder/deployments","created_at":"2018-01-19T15:25:13Z","updated_at":"2018-05-22T15:23:01Z","pushed_at":"2018-05-22T15:25:05Z","git_url":"git://github.com/entando/app-builder.git","ssh_url":"git@github.com:entando/app-builder.git","clone_url":"https://github.com/entando/app-builder.git","svn_url":"https://github.com/entando/app-builder","homepage":"","size":2046,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":1,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/entando/app-builder/pulls/201"},"html":{"href":"https://github.com/entando/app-builder/pull/201"},"issue":{"href":"https://api.github.com/repos/entando/app-builder/issues/201"},"comments":{"href":"https://api.github.com/repos/entando/app-builder/issues/201/comments"},"review_comments":{"href":"https://api.github.com/repos/entando/app-builder/pulls/201/comments"},"review_comment":{"href":"https://api.github.com/repos/entando/app-builder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/entando/app-builder/pulls/201/commits"},"statuses":{"href":"https://api.github.com/repos/entando/app-builder/statuses/566ed46fbc55cd9beaa67be8fd7b9824c5e78ac6"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"fedelocci"}}