Last active
July 14, 2016 20:49
-
-
Save alxhub/b4c3dc5b5d13f9a192241b96384b62ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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