re-authenticate api when user data changes (closes #137)
this re-authenticates a bit more often than necessary, but I think it's fine for now
This commit is contained in:
parent
6a5097a0b6
commit
aa011154ff
2 changed files with 6 additions and 1 deletions
|
@ -1736,6 +1736,7 @@ c3nav = {
|
|||
window.location.reload();
|
||||
},
|
||||
_set_user_data: function (data) {
|
||||
c3nav_api.authenticate();
|
||||
c3nav.user_data = data;
|
||||
var $user = $('header #user');
|
||||
$user.find('span').text(data.title);
|
||||
|
|
|
@ -5,7 +5,11 @@
|
|||
|
||||
constructor(base ) {
|
||||
this.base = base;
|
||||
this.auth_promise = fetch(this.base+'auth/session/', {
|
||||
this.auth_promise = this.authenticate();
|
||||
}
|
||||
|
||||
authenticate() {
|
||||
return fetch(this.base+'auth/session/', {
|
||||
credentials: 'include',
|
||||
method: 'GET',
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue