import React from 'react';
import { Link } from 'react-router';

import Context from './../Context';

export default class LogoutLink extends React.Component {
  render() {
    var router = Context.getInstance().getRouter();

    var logoutRoute = router.getLogoutRoute();
    var targetPath = (logoutRoute || {}).path || '/logout';

  	return (
      <Link to={targetPath} className={this.props.className}>
        { this.props.children ? this.props.children : 'Logout'}
      </Link>
  	);
  }
}

@@ -31,14 +31,55 @@
 ort 
-%7B Link
+ReactMixin from 'react-mixin';%0Aimport %7B History
  %7D f
@@ -135,16 +135,98 @@
 ntext';%0A
+import UserActions from './../actions/UserActions';%0A%0A@ReactMixin.decorate(History)
 %0Aexport 
@@ -282,14 +282,62 @@
 %7B%0A  
-render
+state = %7B%0A    disabled: false%0A  %7D;%0A%0A  _performRedirect
 () %7B
@@ -389,25 +389,24 @@
 uter();%0A
-%0A
     var 
 logoutRo
@@ -397,22 +397,64 @@
     var 
-logout
+homeRoute = router.getHomeRoute();%0A    var login
 Route = 
@@ -466,19 +466,18 @@
 r.getLog
-out
+in
 Route();
@@ -489,36 +489,86 @@
 var 
-targetP
+redirectTo = this.props.redirectTo %7C%7C%C2%A0(homeRoute %7C%7C%C2%A0%7B%7D).p
 ath 
-=
+%7C%7C
  (log
-out
+in
 Route %7C%7C
  %7B%7D)
@@ -563,17 +563,17 @@
 Route %7C%7C
- 
+%C2%A0
 %7B%7D).path
@@ -579,92 +579,407 @@
 h %7C%7C
- '/logout';%0A%0A  %09return (%0A      %3CLink to=%7BtargetPath%7D className=%7Bthis.props.className
+%C2%A0'/';%0A%0A    this.history.pushState(null, redirectTo);%0A  %7D%0A%0A  onClick(e) %7B%0A    e.preventDefault();%0A%0A    if (!this.state.disabled) %7B%0A      this.setState(%7B disabled: true %7D);%0A%0A      UserActions.logout(() =%3E %7B%0A        this._performRedirect();%0A      %7D);%0A    %7D%0A  %7D%0A%0A  render() %7B%0A  %09return (%0A      %3Ca  href='#' className=%7Bthis.props.className%7D onClick=%7Bthis.onClick.bind(this)%7D disabled=%7Bthis.state.disabled
 %7D%3E%0A 
@@ -1049,20 +1049,17 @@
       %3C/
-Link
+a
 %3E%0A  %09);%0A

change LogoutLink to call logout API instead of redirecting to LogoutRoute