# @cjsx React.DOM
React = require('react')
Card = require('./card')
Message = require('./message')
module.exports = React.createClass
displayName: 'Cards'
getInitialState: ()->
error: false
componentDidMount: ()->
console.log '[views/cards] component did mount'
@props.cards.on 'sync', @forceUpdate.bind(@, null)
if @props.card
@props.card.on 'error', (model, response)=>
@setState error: response
@forceUpdate.bind(@, null)
componentWillReceiveProps: (nextProps)->
console.log '[views/cards] component will receive props'
nextProps.cards.on 'sync', @forceUpdate.bind(@, null)
if nextProps.card
nextProps.card.on 'error', (model, response)=>
@setState error: response
@forceUpdate.bind(@, null)
render: ->
if @props.cards.fetching