Bloc / Messenger

This is a small app to message using the Bloc Api
8 stars 3 forks source link

Adds axios post and fixes the login error #46

Closed bdougie closed 8 years ago

bdougie commented 8 years ago

31 Was closed but it started a trend that fixes the Api calls to the Bloc Api.

What is this?

Login has been broken for a week and seems like the request being made by fetch() aren't cutting anymore.

Basically the JSON.parse(res._bodyText) are not working anymore. I have the [axios](https://github.com/mzabriskie/axios) to do the fetch and JSON parsing in one function. I was trying to avoid adding a dependency to just pull in data, but this seems a bit necessary.

Please review

$ git fetch
$ git checkout fix-api-auth
drbeowulf commented 8 years ago

@bdougie See now pull request #47. We don't need axios.

bdougie commented 8 years ago

Nice, I am going to run this locally shortly

bdougie commented 8 years ago

I get this:

console.log(res.status.ok)
=> undefined
drbeowulf commented 8 years ago

You will get undefined because res.status.ok is incorrect. You have to use res.ok instead. However, since you're not using fetch that won't work because axios has a different API. It would be better, however, for you to use res.status === 200 or whatever number you're looking for.

drbeowulf commented 8 years ago

Sorry, but this merge does not allow me to login and view messages.

bdougie commented 8 years ago

moving conversation to #47