A
A
Alexey Dugnist2015-11-19 16:28:23
OOP
Alexey Dugnist, 2015-11-19 16:28:23

Why doesn't callback work?

setAuth: ( some, cb) ->		
  if !some
    @getlogin = 
      response: 'not found'
      object: 'user'
  else
    @getlogin = 
      response: 'success'
      object: 'user'
      data: getLogin
  cb @getlogin

I call it like this:
setAuth( some, (cb)->
res.send cb
)
As a result, @getlogin gives undefined on the first page refresh, and an object on the second one...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question