Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

438
Visualizações
I'm having an Error in Mounted hook (Promise/Async) in my Vue js App

ive setup my Vuex store and modules with all endpoints declared in my actions and connected to the getters too.

but my app returns this error compilation.

Help me check what might be wrong.

I have this in my methods

...mapActions('codes', [
      'fetchCode',
      'fetchCodes',
      'updateCode',
      'selectCode',
      'setSelectAllState'
  ]),

  async fetchData({page, sort}) {
    let data = {

      name: this.filters.name ? this.filters.name : null,

        from_date:
          this.filters.from_date === ''
            ? this.filters.from_date
            : this.filters.from_date,

        to_date:
          this.filters.to_date === ''
            ? this.filters.to_date
            : this.filters.to_date,

        orderByField: sort.fieldName || 'created_at',

        orderBy: sort.order || 'desc',
        page,
    }

    this.isRequestOngoing = true
    let response = await this.fetchCodes(data)
    this.isRequestOngoing = false

  

  return {
    
    data: response.data.result.data,

  }    
  },

It only returns this error in my browser console

[Vue warn]: Error in mounted hook (Promise/async): "TypeError: Cannot read properties of undefined (reading 'page')"

I've googled the hell out of this error, checked my api numerous times.. :(

Meanwhile the

  let response = await this.fetchCodes(data)

gets its data from this end (actions.js)

import * as types from './mutation-types'
export const fetchCodes = ({commit, dispatch, state}, params) => {
    return new Promise((resolve, reject) => {
        window.axios
        .get(`/api/myendpoint`, {params})
        .then((response)=>{
            commit(types.FETCH_CODES, response.data.result.data)
            resolve(response)
        })
        .catch((err)=>{
            reject(err)
        })
    })
}

I've fixed the mutations to connect with their states too

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda