jeudi 28 décembre 2017

How to effect two axios calls in same mounted method and load diffrent data for two dropdowns select menus

I have these two select dropdown menus

  <div class="col-xs-12 form-group">
                    <label class="control-label">Equipe</label>
                    <select v-model="category.cat_id">
                      <option v-for="category in category" v-bind:value="category.cat_id">
                        
                            </option>
                    </select>
                </div>
              </div>
              <div class="row">
                <div class="col-xs-12 form-group">
                    <label class="control-label">Metier</label>
                    <select v-model="team.tem_id">
                      <option v-for="team in team" v-bind:value="team.tem_id">
                        
                            </option>
                    </select>
                </div>
              </div>

Also i have two diffrent axios calls for them in same component

mounted() {
      let app = this;
      axios.get('/api/v1/categories/')
          .then(function (resp) {
              app.category = resp.data
              ;
          })
          .catch(function () {
              alert("Could not load your categorie")
          });


          let aps = this;
          axios.get('/api/v1/teams/')
              .then(function (resp) {
                  aps.team = resp.data;
              })
              .catch(function () {
                  alert("Could not load your teams")
              });

            },

On the end i get this mistake

app.js:1002 GET http://ift.tt/2llA4iY 404 (Not Found)

I tested both API's and they work fine, but when i put them togehter they cant work. For first dropdown menu i get data, for second i get response couldnt load your teams.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2C44hym
via IFTTT

Aucun commentaire:

Enregistrer un commentaire