Fix parse error on "done" response from the API
We sometimes get "done" as a response body from API when authenticating. We should properly fix it in the API, but for now I will add this quick fix to not completely break on login when it happens until we have proper fix.
This commit is contained in:
parent
875295c1a1
commit
d12a444aed
|
@ -49,7 +49,13 @@
|
|||
|
||||
# TODO should have clearData() to clean this up
|
||||
setData: (data) ->
|
||||
data = JSON.parse(data) if typeof data == 'string'
|
||||
if typeof data == 'string'
|
||||
# TODO: I sometimes see plain text response "done" when authenticating
|
||||
# we should track down why is that happening and fix the API
|
||||
if data == 'done'
|
||||
data = {}
|
||||
else
|
||||
data = JSON.parse(data)
|
||||
@storeToken(data.token) if data?.token
|
||||
console.log 'setData', data.user if data?.user
|
||||
user = @storeUser(data.user) if data?.user
|
||||
|
|
Loading…
Reference in New Issue
Block a user