Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

282
Views
¿Obtener datos json en $router.push en Vue.js?

soy nuevo en js, e intento crear un enrutador desde mi backend /user-info donde se almacena toda la información del usuario actual:

ingrese la descripción de la imagen aquí

Ahora, quería encontrar un medio para manejar cada información para usar eso en mi Dashboard de Vuejs, usé axios para eso, así que esto es lo que hice para index.js :

 const express = require('express') const router = express.Router() const { ensureAuth, ensureGuest } = require('../middleware/auth') const axios = require('axios') router.get('/user-info', ensureAuth, async (req, res) => { try { let uri = 'http://localhost:5000/user-info'; res.json(`userInfo : ${req.user}`); this.axios.get(uri).then((response) => { this.$router.push({name:'Dashboard'}); } catch (err) { console.error(err) res.render('error') } })

... y lo que hice para mi Dashboard.vue :

 <template> <div class="customers container"> <h1 class="page-header">Welcome to your dashboard</h1> <table class="table table-striped"> <thead> <tr> <td>{{user.image}}</td> <td>{{'Hello' user.displayName}}</td> <<td>{{user.email}}</td> <th></th> </tr> </thead> </table> </div> </template> <script> export default { name: 'dashboard', data () { return { user: [], } }, methods: { getUserInfo(){ this.$http.get('http:localhost:5000/user-info') .then(function(response){ this.user = (response.body); }); } </script>

Desafortunadamente tengo nodemon:

[nodemon] app crashed - waiting for file changes before starting...

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!