title: Performing asynchronous actions with parameters mobx-state-tree
body: <p>Using mobx-state-tree I want to pass in parameters to an asynchronous action. They recommend to use generator functions. Their examples does not supply examples using parameters, and I don't find it obvious how to.</p>
  
  <p>I have tried wrapping the flow function inside a normal function to pass the parameters down. However it does not work. I have tried examples below including some additional fiddling.</p>
  
  <pre><code>setAvailability: function (id, status) {
          console.log("inside outer")
          flow(function* () {
              console.log("inside inner")
              try {
                  yield UpdateAvailability(id, status)
                  const { data } = yield self.fetch(GetTutors)
                  self.data = data;
              } catch (e) {
                  console.log(e.stack)
              }
          })
      },
  </code></pre>
  
  <hr>
  
  <pre><code>setAvailability: flow*(function(id, status) {
              console.log("inside inner")
              try {
                  yield UpdateAvailability(id, status)
                  const { data } = yield self.fetch(GetTutors)
                  self.data = data;
              } catch (e) {
                  console.log(e.stack)
              }
          })
      },
  </code></pre>
  
  <p>When passing parameters inside the flow function it doesn't compile and when I wrap the function it only prints 
  <code>console.log("inside inner")</code></p>
  
  <p>How can I pass parameters to an asynchronous action function?</p>