1
0
Fork 0
oldhaven/app/assets/javascripts/session.coffee

33 lines
607 B
CoffeeScript
Raw Normal View History

2011-09-07 23:47:11 +00:00
class window.Session
2011-06-27 18:41:36 +00:00
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
2011-07-02 14:10:59 +00:00
_beathaven.lang = @user.lang || 'ru'
2011-06-30 05:12:52 +00:00
_beathaven.localizeHTML()
2011-06-27 20:43:54 +00:00
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