{"action":"created","issue":{"url":"https://api.github.com/repos/edesilets/thermal-comfort-system-API/issues/2","repository_url":"https://api.github.com/repos/edesilets/thermal-comfort-system-API","labels_url":"https://api.github.com/repos/edesilets/thermal-comfort-system-API/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/edesilets/thermal-comfort-system-API/issues/2/comments","events_url":"https://api.github.com/repos/edesilets/thermal-comfort-system-API/issues/2/events","html_url":"https://github.com/edesilets/thermal-comfort-system-API/issues/2","id":146398170,"number":2,"title":"Successful Sign out needs correct status code","user":{"login":"edesilets","id":12851296,"avatar_url":"https://avatars.githubusercontent.com/u/12851296?v=3","gravatar_id":"","url":"https://api.github.com/users/edesilets","html_url":"https://github.com/edesilets","followers_url":"https://api.github.com/users/edesilets/followers","following_url":"https://api.github.com/users/edesilets/following{/other_user}","gists_url":"https://api.github.com/users/edesilets/gists{/gist_id}","starred_url":"https://api.github.com/users/edesilets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edesilets/subscriptions","organizations_url":"https://api.github.com/users/edesilets/orgs","repos_url":"https://api.github.com/users/edesilets/repos","events_url":"https://api.github.com/users/edesilets/events{/privacy}","received_events_url":"https://api.github.com/users/edesilets/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/edesilets/thermal-comfort-system-API/labels/bug","name":"bug","color":"ee0701"},{"url":"https://api.github.com/repos/edesilets/thermal-comfort-system-API/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":{"login":"edesilets","id":12851296,"avatar_url":"https://avatars.githubusercontent.com/u/12851296?v=3","gravatar_id":"","url":"https://api.github.com/users/edesilets","html_url":"https://github.com/edesilets","followers_url":"https://api.github.com/users/edesilets/followers","following_url":"https://api.github.com/users/edesilets/following{/other_user}","gists_url":"https://api.github.com/users/edesilets/gists{/gist_id}","starred_url":"https://api.github.com/users/edesilets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edesilets/subscriptions","organizations_url":"https://api.github.com/users/edesilets/orgs","repos_url":"https://api.github.com/users/edesilets/repos","events_url":"https://api.github.com/users/edesilets/events{/privacy}","received_events_url":"https://api.github.com/users/edesilets/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2016-04-06T18:34:26Z","updated_at":"2016-04-06T21:01:56Z","closed_at":"2016-04-06T21:01:56Z","body":"Status Code from the backend is `DELETE /sign-out/9 404 3.000 ms - 105` Ajax on the front end sees the 404 as a failure. "},"comment":{"url":"https://api.github.com/repos/edesilets/thermal-comfort-system-API/issues/comments/206566334","html_url":"https://github.com/edesilets/thermal-comfort-system-API/issues/2#issuecomment-206566334","issue_url":"https://api.github.com/repos/edesilets/thermal-comfort-system-API/issues/2","id":206566334,"user":{"login":"edesilets","id":12851296,"avatar_url":"https://avatars.githubusercontent.com/u/12851296?v=3","gravatar_id":"","url":"https://api.github.com/users/edesilets","html_url":"https://github.com/edesilets","followers_url":"https://api.github.com/users/edesilets/followers","following_url":"https://api.github.com/users/edesilets/following{/other_user}","gists_url":"https://api.github.com/users/edesilets/gists{/gist_id}","starred_url":"https://api.github.com/users/edesilets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edesilets/subscriptions","organizations_url":"https://api.github.com/users/edesilets/orgs","repos_url":"https://api.github.com/users/edesilets/repos","events_url":"https://api.github.com/users/edesilets/events{/privacy}","received_events_url":"https://api.github.com/users/edesilets/received_events","type":"User","site_admin":false},"created_at":"2016-04-06T21:01:56Z","updated_at":"2016-04-06T21:01:56Z","body":"I assigned a new http error to when user can't be found.\r\n\r\n```diff\r\nconst signout = (req, res, next) => {\r\n  getToken().then((token) => {\r\n    let findUser = {\r\n      id: req.params.id,\r\n      token: req.currentUser.token\r\n    };\r\n    new User(findUser)\r\n    .save({\r\n      token: token\r\n    },{\r\n      patch: true\r\n+    }).then((user) => user ? res.sendStatus(200) : next(new HttpError(404)));\r\n  })\r\n-  .then((user) =>\r\n-    user ? res.sendStatus(200) : next()\r\n-  )\r\n  .catch(next);\r\n};\r\n\r\n````"}}