 ApiToken = require './apitoken'
 List = require 'app/components/list'
 Toggle = require 'app/components/common/toggle'
-remote = require 'app/remote'
-TeamFlux = require 'app/flux/teams'
-showError = require 'app/util/showError'
 
 
 module.exports = class View extends React.Component
-
-  constructor: (props) ->
-
-    super props
 
 
   numberOfSections: -> 1

    <div className='HomeApp-ApiToken--no-token'> No tokens have been created yet. When you create, they will be listed here.</div>


  addNewApiToken: ->

    remote.api.JApiToken.create (err, apiToken) ->
      return showError err  if err
      TeamFlux.actions.addApiToken apiToken


  switchToggle: (state) ->

    TeamFlux.actions.disableApiTokens(state)
    .catch ({err}) ->
      showError err

  render: ->

    toggleState = @props.apiAccessState

          <AddNewApiTokenButton toggleState={toggleState} callback={@bound 'addNewApiToken'}/>
        </div>
      </div>
    </div>

Header = ->

  label = 'Enable API Access'
  description = 'Allow 3rd party services to securely communicate with Koding.'
