title: How to pass dynamic parameter (ID) to axios api call?
body: <p>I have an api with the last part dynamic:
  src/api/user.js</p>
  
  <pre><code>export function getProfileData() {
    return request({
      url: 'http://localhost:8000/profile_update/DYNAMIC USER ID HERE',
      method: 'get',
    })
  }
  </code></pre>
  
  <p>I am calling this api in this action:
  store/modules/user.js</p>
  
  <pre><code>setProfileData({ commit }) {
   return getProfileData(userId).then(response =&gt; {
   console.log('RESPONSE setProfileData action dispatch', response)
   commit('SET_PROFILE_DATA', response.results)
  })
  </code></pre>
  
  <p>(In this module I also have state and mutations - working)
  This action is dispatched here:
  src/views/users-list</p>
  
  <pre><code>goToUserProfile(user) {
    const userId = user.id
    this.$store.dispatch('user/setCurrentUser').then(() =&gt; {
      const profileData = this.$store.dispatch('user/setProfileData(userId)').then(() =&gt; {
        const profileData = this.$store.getters.profileData
        this.profileData = profileData
        console.log('users-list sending profile data: ', profileData )
        this.$router.push({
          name: 'SeeUserProfile',
          params: {
          userId: userId
        } 
      })
    }).catch((err) =&gt; {
       console.log('ERROR IN fetchin' userDataProfile: ', err)
       this.loading = false
     })
   })
  }
  </code></pre>
  
  <p>The argument user comes from</p>
  
  <pre><code>@click.prevent="goToUserProfile(data.item), selectUser(data.item)"
  </code></pre>
  
  <p>So data.item = single selected user</p>
  
  <p>This code is not working.
  I need the dynamic user id to be used in the api.
  In the store I also have:</p>
  
  <pre><code>setCurrentUser({ commit }, userData) {
  commit('SET_CURRENT_USER', userData)}
  </code></pre>
  
  <p>which is working fine -inside userData there is the property id.</p>
  
  <p>I tried using <strong>/${params.userId}</strong>, but how do I pass this in the api?</p>
  
  <p>How do I pass the userId to the axios call?
  Hope I’ve been clear.
  I’ve extracted very much the code, so if needed I will post all of it.</p>