title: Choose the api to use programmatically
body: <p>I’m developing an app that CRUD orders to external databases. Obviously these databases have different APIs.</p>
  <p>I have created an abstraction layer that calls the correct API and is the only thing that will change if databases are added.</p>
  <p>This works perfectly, but I’m wondering if there are more efficient ways to do this.</p>
  <p>The way I do it now:</p>
  <p>Front end:</p>
  <pre><code>addOrder(orderId,productName, ......)
  </code></pre>
  <p>Abstraction layer:</p>
  <pre><code>let addOrder = (orderId, productName, ......) =&gt; {
    if (selectedDatabase == ‘x’) {
      insertOrder(orderId, productName, ......)
    } else {
      AddOrder(orderId, productName, .....)
    }
  </code></pre>
  <p>I’m using Vue.js and Vuex and a solution using vuex would be wonderful.</p>