mirror of
https://github.com/documize/community.git
synced 2025-08-08 23:15:29 +02:00
Clean up
This commit is contained in:
parent
69c760d351
commit
7cce377f93
2 changed files with 21 additions and 21 deletions
|
@ -139,6 +139,26 @@ export default Ember.Service.extend({
|
|||
|
||||
// Application boot process
|
||||
boot() {
|
||||
let token = this.getSessionItem('token');
|
||||
|
||||
// TODO: the rest should be done through ESA
|
||||
if (is.not.undefined(token)) {
|
||||
// We now validate current token
|
||||
|
||||
return this.get('ajax').request(`public/validate?token=${token}`, {
|
||||
method: 'GET',
|
||||
contentType: 'json'
|
||||
}).then((user) => {
|
||||
this.setSession(token, models.UserModel.create(user));
|
||||
this.set('ready', true);
|
||||
}).catch((reason) => {
|
||||
if (netUtil.isAjaxAccessError(reason)) {
|
||||
localStorage.clear();
|
||||
window.location.href = "/auth/login";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let self = this;
|
||||
let dbhash = "";
|
||||
|
||||
|
@ -194,25 +214,5 @@ export default Ember.Service.extend({
|
|||
});
|
||||
}
|
||||
});
|
||||
|
||||
let token = this.getSessionItem('token');
|
||||
|
||||
// TODO: the rest should be done through ESA
|
||||
if (is.not.undefined(token)) {
|
||||
// We now validate current token
|
||||
|
||||
return this.get('ajax').request(`public/validate?token=${token}`, {
|
||||
method: 'GET',
|
||||
contentType: 'json'
|
||||
}).then((user) => {
|
||||
this.setSession(token, models.UserModel.create(user));
|
||||
this.set('ready', true);
|
||||
}).catch((reason) => {
|
||||
if (netUtil.isAjaxAccessError(reason)) {
|
||||
localStorage.clear();
|
||||
window.location.href = "/auth/login";
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue