{"action":"created","issue":{"url":"https://api.github.com/repos/cargomedia/CM/issues/1754","labels_url":"https://api.github.com/repos/cargomedia/CM/issues/1754/labels{/name}","comments_url":"https://api.github.com/repos/cargomedia/CM/issues/1754/comments","events_url":"https://api.github.com/repos/cargomedia/CM/issues/1754/events","html_url":"https://github.com/cargomedia/CM/issues/1754","id":71895524,"number":1754,"title":"CM_App.ajax: Return usable Promise","user":{"login":"njam","id":360800,"avatar_url":"https://avatars.githubusercontent.com/u/360800?v=3","gravatar_id":"","url":"https://api.github.com/users/njam","html_url":"https://github.com/njam","followers_url":"https://api.github.com/users/njam/followers","following_url":"https://api.github.com/users/njam/following{/other_user}","gists_url":"https://api.github.com/users/njam/gists{/gist_id}","starred_url":"https://api.github.com/users/njam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njam/subscriptions","organizations_url":"https://api.github.com/users/njam/orgs","repos_url":"https://api.github.com/users/njam/repos","events_url":"https://api.github.com/users/njam/events{/privacy}","received_events_url":"https://api.github.com/users/njam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"vogdb","id":372386,"avatar_url":"https://avatars.githubusercontent.com/u/372386?v=3","gravatar_id":"","url":"https://api.github.com/users/vogdb","html_url":"https://github.com/vogdb","followers_url":"https://api.github.com/users/vogdb/followers","following_url":"https://api.github.com/users/vogdb/following{/other_user}","gists_url":"https://api.github.com/users/vogdb/gists{/gist_id}","starred_url":"https://api.github.com/users/vogdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vogdb/subscriptions","organizations_url":"https://api.github.com/users/vogdb/orgs","repos_url":"https://api.github.com/users/vogdb/repos","events_url":"https://api.github.com/users/vogdb/events{/privacy}","received_events_url":"https://api.github.com/users/vogdb/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-04-29T14:44:51Z","updated_at":"2015-04-30T08:34:39Z","closed_at":null,"body":"Currently `CM_App.ajax()` returns the original jqXHR \"Deferred\" object.\r\nIt only rejects if the ajax request fails (e.g. network problem or non-200 response). But if we experience an expected application error (e.g. \"auth required\") it will *resolve*.\r\n\r\nIt would be great if `ajax()` would return a usable \"Promise\", that:\r\n- Resolves when the request finished successfully (like `success` callback)\r\n- Rejects when the request fails (like `error` callback)\r\n\r\nWe should also consider using [ES6's Promise](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise) interface instead of jQuery's Promise: https://www.promisejs.org/#jquery\r\n\r\n@vogdb @tomaszdurka thoughts?"},"comment":{"url":"https://api.github.com/repos/cargomedia/CM/issues/comments/97707086","html_url":"https://github.com/cargomedia/CM/issues/1754#issuecomment-97707086","issue_url":"https://api.github.com/repos/cargomedia/CM/issues/1754","id":97707086,"user":{"login":"tomaszdurka","id":113303,"avatar_url":"https://avatars.githubusercontent.com/u/113303?v=3","gravatar_id":"","url":"https://api.github.com/users/tomaszdurka","html_url":"https://github.com/tomaszdurka","followers_url":"https://api.github.com/users/tomaszdurka/followers","following_url":"https://api.github.com/users/tomaszdurka/following{/other_user}","gists_url":"https://api.github.com/users/tomaszdurka/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaszdurka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaszdurka/subscriptions","organizations_url":"https://api.github.com/users/tomaszdurka/orgs","repos_url":"https://api.github.com/users/tomaszdurka/repos","events_url":"https://api.github.com/users/tomaszdurka/events{/privacy}","received_events_url":"https://api.github.com/users/tomaszdurka/received_events","type":"User","site_admin":false},"created_at":"2015-04-30T08:34:39Z","updated_at":"2015-04-30T08:34:39Z","body":"I think it's great idea. We should definietly use es6-like solution.\r\n- https://github.com/jakearchibald/es6-promise"}}