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

31 lines
533 B
CoffeeScript

class Session
vk_params: null
user: null
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
query: (url, params, callback) ->
q_params = $.extend {}, @vk_params, params
$.post url, q_params, callback
false
reloadSession: ->
_session.query '/user/auth', {}, (ar) ->
_session.setUser ar.user
false
false