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

185
Visualizações
How do I get the id of the created order

I am using Strapi with Nuxt and I would like to redirect to the new order it was created after successfully posting the order to Strapi. What I'm looking for is the equivalent of mysql_insert_id() in the PHP world.

code example

try {
    const neworder = await this.$strapi.$orders.create(this.neworder)
    console.log(neworder)
    if(neworder !== null) {
        this.$router.push({ name:'order-id', params: neworder.id })
    }
} catch (error) {
    this.error = error
}

I can see the new id on the console log:

console log

How do I access the returned id and pass it to this.$router.push's params? I tried using 'id' same as it shows on the console but no luck.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I figured it out. I'm going to leave this open in case it helps someone else.

redirect ($router.push) should be like this:

this.$router.push({ name:'order-id', params: {id: neworder.id }})
about 4 years ago · Juan Pablo Isaza Relatório
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