mirror of
https://github.com/documize/community.git
synced 2025-08-09 15:35:27 +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
|
// Application boot process
|
||||||
boot() {
|
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 self = this;
|
||||||
let dbhash = "";
|
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