Permalink
Browse files

feat(authService): optional logout request

  • Loading branch information...
doktordirk committed May 20, 2016
1 parent a8aad5f commit d65ca7ba5a5afa9394d495e4938711eda0a85d1d
Showing with 9 additions and 2 deletions.
  1. +5 −2 src/authService.js
  2. +4 −0 src/baseConfig.js
@@ -239,13 +239,16 @@ export class AuthService {
* @return {Promise<>}
*/
logout(redirectUri) {
return new Promise(resolve => {
let localLogout = () => new Promise(resolve => {
this.authentication.responseObject = null;
this.authentication.redirect(redirectUri, this.config.logoutRedirect);
resolve();
});
return (this.config.logoutUrl
? this.client.request(this.config.logoutMethod, this.config.withBase(this.config.logoutUrl)).then(localLogout)
: localLogout());
}
/**
@@ -59,6 +59,10 @@ export class BaseConfig {
baseUrl = '';
// The API endpoint to which login requests are sent
loginUrl = '/auth/login';
// The API endpoint to which logout requests are sent (not needed for jwt)
logoutUrl = null;
// The HTTP method used for 'unlink' requests (Options: 'get' or 'post')
logoutMethod = 'get';
// The API endpoint to which signup requests are sent
signupUrl = '/auth/signup';
// The API endpoint used in profile requests (inc. `find/get` and `update`)

0 comments on commit d65ca7b

Please sign in to comment.