     user: null
     loading: false
     error: null
+
+  signOut:(e)->
+    e.preventDefault()
+
+    request = $.ajax({url: '/users/sign_out', method: 'delete'})
+
+    request.done =>
+      @setState
+        user:null
+
+    request.error =>
+      @setState
+        error : "Could not log out"
 
   fetchUser:->
     @setState

    </div>

  renderLoggedIn:->
    <p>Hello {@state.user.name} <a href='/users/sign_out'>Logout</a></p>


  renderLoggedOut:->

        error: "Having trouble logging you in"

  render:->
    <div className='login'>
      {@renderError() if @state.error}

      {@renderLoggedIn() if @state.user}
