--
-- Created by IntelliJ IDEA.
-- User: nmoya
-- Date: 8/3/15
-- Time: 6:15 PM
-- To change this template use File | Settings | File Templates.
--

return {
  LOGIN = {
    function (action, params)
      dispatch('loading.START')
      local deferred = Promise:new()
      net.http.post("https://www.virginamerica.com/api/v0/cart/create", {},
        function(cartId)
          deferred:resolve({action, params})
        end)
      return action, deferred
    end,
    function(action, params)
      local deferred = Promise:new()
      net.http.post("https://www.virginamerica.com/api/v0/elevate/login",
        params,
        function(response)
          dispatch('loading.FINISH')
          deferred:resolve({action, response})
        end)
      return action, deferred
    end
    }
}

