diff --git a/app/components/nav-bar/index.js b/app/components/nav-bar/index.js index dfb91f27..821d2800 100644 --- a/app/components/nav-bar/index.js +++ b/app/components/nav-bar/index.js @@ -41,6 +41,15 @@ export default class NavBar extends Component { @action async logOut() { + const url = `${window.location.origin}/logout`; + await fetch(url, { + method: 'POST', + headers: { + Accept: 'application/vnd.api+json', + 'Content-Type': 'application/vnd.api+json', + 'X-XSRF-TOKEN': document.cookie.match(/XSRF-TOKEN\=([^;]*)/)['1'], + }, + }); await this.session.invalidate(); } diff --git a/app/services/session.js b/app/services/session.js index b9d3962a..089d6e6f 100644 --- a/app/services/session.js +++ b/app/services/session.js @@ -10,7 +10,7 @@ export default class SessionService extends BaseSessionService { @public */ handleInvalidation() { - window.location.replace(`${window.location.origin}/logout`); + window.location.replace(`${window.location.origin}/`); } handleAuthentication() {