Skip to content

Instantly share code, notes, and snippets.

@alxhub
Last active July 14, 2016 20:49
Show Gist options
  • Save alxhub/b4c3dc5b5d13f9a192241b96384b62ee to your computer and use it in GitHub Desktop.
Save alxhub/b4c3dc5b5d13f9a192241b96384b62ee to your computer and use it in GitHub Desktop.
logout(): Promise<void> {
if (this.store.local.getItem(AUTH_STORAGE_KEY) || this.store.session.getItem(AUTH_STORAGE_KEY)) {
return this
.api
.post('Citizens/logout', {})
.catch(err => {
this.log.error(Error(`Unable to logout - response: ${res.status}`));
return Observable.of(null);
})
.do(() => {
this.authentication = null;
this.store.local.removeItem(AUTH_STORAGE_KEY);
this.store.session.removeItem(AUTH_STORAGE_KEY);
})
.toPromise();
} else {
return Promise.resolve();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment