1
0
Fork 0
oldhaven/app/coffeescripts/session.coffee

31 lines
533 B
CoffeeScript
Raw Normal View History

2011-06-27 18:41:36 +00:00
class Session
vk_params: null
user: null
2011-06-27 20:43:54 +00:00
constructor: (params) ->
attrs = ['expire', 'mid', 'secret', 'sid', 'sig']
_params = {}
for key in attrs
if params[key]?
_params[key] = params[key]
@vk_params = _params
setUser: (user) ->
@user = user
false
getUser: ->
@user
2011-06-27 18:41:36 +00:00
query: (url, params, callback) ->
2011-06-29 13:54:55 +00:00
q_params = $.extend {}, @vk_params, params
2011-06-27 18:41:36 +00:00
$.post url, q_params, callback
false
2011-06-29 04:11:54 +00:00
reloadSession: ->
_session.query '/user/auth', {}, (ar) ->
2011-06-29 13:54:55 +00:00
_session.setUser ar.user
false
false