{"action":"created","issue":{"url":"https://api.github.com/repos/mitodl/micromasters/issues/3805","repository_url":"https://api.github.com/repos/mitodl/micromasters","labels_url":"https://api.github.com/repos/mitodl/micromasters/issues/3805/labels{/name}","comments_url":"https://api.github.com/repos/mitodl/micromasters/issues/3805/comments","events_url":"https://api.github.com/repos/mitodl/micromasters/issues/3805/events","html_url":"https://github.com/mitodl/micromasters/pull/3805","id":294523078,"number":3805,"title":"fix financial aid skip bug","user":{"login":"aliceriot","id":6207644,"avatar_url":"https://avatars0.githubusercontent.com/u/6207644?v=4","gravatar_id":"","url":"https://api.github.com/users/aliceriot","html_url":"https://github.com/aliceriot","followers_url":"https://api.github.com/users/aliceriot/followers","following_url":"https://api.github.com/users/aliceriot/following{/other_user}","gists_url":"https://api.github.com/users/aliceriot/gists{/gist_id}","starred_url":"https://api.github.com/users/aliceriot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aliceriot/subscriptions","organizations_url":"https://api.github.com/users/aliceriot/orgs","repos_url":"https://api.github.com/users/aliceriot/repos","events_url":"https://api.github.com/users/aliceriot/events{/privacy}","received_events_url":"https://api.github.com/users/aliceriot/received_events","type":"User","site_admin":false},"labels":[{"id":335628406,"url":"https://api.github.com/repos/mitodl/micromasters/labels/Waiting%20on%20Author","name":"Waiting on Author","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":{"login":"mbertrand","id":187676,"avatar_url":"https://avatars2.githubusercontent.com/u/187676?v=4","gravatar_id":"","url":"https://api.github.com/users/mbertrand","html_url":"https://github.com/mbertrand","followers_url":"https://api.github.com/users/mbertrand/followers","following_url":"https://api.github.com/users/mbertrand/following{/other_user}","gists_url":"https://api.github.com/users/mbertrand/gists{/gist_id}","starred_url":"https://api.github.com/users/mbertrand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbertrand/subscriptions","organizations_url":"https://api.github.com/users/mbertrand/orgs","repos_url":"https://api.github.com/users/mbertrand/repos","events_url":"https://api.github.com/users/mbertrand/events{/privacy}","received_events_url":"https://api.github.com/users/mbertrand/received_events","type":"User","site_admin":false},"assignees":[{"login":"mbertrand","id":187676,"avatar_url":"https://avatars2.githubusercontent.com/u/187676?v=4","gravatar_id":"","url":"https://api.github.com/users/mbertrand","html_url":"https://github.com/mbertrand","followers_url":"https://api.github.com/users/mbertrand/followers","following_url":"https://api.github.com/users/mbertrand/following{/other_user}","gists_url":"https://api.github.com/users/mbertrand/gists{/gist_id}","starred_url":"https://api.github.com/users/mbertrand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbertrand/subscriptions","organizations_url":"https://api.github.com/users/mbertrand/orgs","repos_url":"https://api.github.com/users/mbertrand/repos","events_url":"https://api.github.com/users/mbertrand/events{/privacy}","received_events_url":"https://api.github.com/users/mbertrand/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-02-05T19:59:27Z","updated_at":"2018-02-08T15:56:56Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/mitodl/micromasters/pulls/3805","html_url":"https://github.com/mitodl/micromasters/pull/3805","diff_url":"https://github.com/mitodl/micromasters/pull/3805.diff","patch_url":"https://github.com/mitodl/micromasters/pull/3805.patch"},"body":"#### What are the relevant tickets?\r\n\r\ncloses #3803 \r\n\r\n#### What's this PR do?\r\n\r\nfixes a bug! the bug was due to our use of the `fetchJSONWithCSRF` function for skipping financial aid. The `fetchJSONWithCSRF` function assumes that the response has a JSON payload, and it tries to parse the payload. If it doesn't parse correctly it throws an error.\r\n\r\nThe `skipFinancialAid` endpoint doesn't return a JSON payload when it is `PATCH`'ed, so we were trying to parse JSON where there was none to be parsed. Anyway, this meant that basically after the request came back as a 200 but before the 'success' action could be dispatched to the redux store we were throwing an error in the `fetchJSONWithCSRF` function that was causing the failure-case toast message to pop-up.\r\n\r\nSo, to fix it I just changed the API function to use `fetchWithCSRF` instead, which doesn't assume the body of the request contains anything in particular, and will only reject if HTTP code is an error code. This should fix the error in production. I also did a small bit of cleanup to the relevant function in the `DashboardPage` component.\r\n\r\n#### How should this be manually tested?\r\n\r\nDelete your financial aid or otherwise do something to get rid of it. Confirm that, on master, if you try to skip financial aid it will a) work successfully and return a 200 and b) show the 'failure' message and fail to go on to refresh the dashboard and course price information.\r\n\r\nThen, get rid of your financial aid again, check out this branch, and confirm that my changes fix the issue. So skipping financial aid should work, and after it goes through successfully you should see the dashboard refresh so that the new course price information can be reflected in the UI."},"comment":{"url":"https://api.github.com/repos/mitodl/micromasters/issues/comments/364156457","html_url":"https://github.com/mitodl/micromasters/pull/3805#issuecomment-364156457","issue_url":"https://api.github.com/repos/mitodl/micromasters/issues/3805","id":364156457,"user":{"login":"aliceriot","id":6207644,"avatar_url":"https://avatars0.githubusercontent.com/u/6207644?v=4","gravatar_id":"","url":"https://api.github.com/users/aliceriot","html_url":"https://github.com/aliceriot","followers_url":"https://api.github.com/users/aliceriot/followers","following_url":"https://api.github.com/users/aliceriot/following{/other_user}","gists_url":"https://api.github.com/users/aliceriot/gists{/gist_id}","starred_url":"https://api.github.com/users/aliceriot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aliceriot/subscriptions","organizations_url":"https://api.github.com/users/aliceriot/orgs","repos_url":"https://api.github.com/users/aliceriot/repos","events_url":"https://api.github.com/users/aliceriot/events{/privacy}","received_events_url":"https://api.github.com/users/aliceriot/received_events","type":"User","site_admin":false},"created_at":"2018-02-08T15:56:56Z","updated_at":"2018-02-08T15:56:56Z","author_association":"MEMBER","body":"@mbertrand comments addressed!"}}
{"actor":{"display_login":"aliceriot"}}