Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

176
Vistas
React js handle error from request api Laravel

Hello guys I have a problem to handle error from validation Laravel i have service class

import axios from "axios";
import { LogIn } from "react-feather";
import Alert from "../components/Alert";
import { API_BASE_URL  , BASE_URL} from "../config";

class UserService {

   async getUserInformation(id){
       try{
        const result = await axios.get(API_BASE_URL + '/getUserInformation' , { params: { id: id } })
        return result.data.users
       }catch(e){
        return false;
       }
   }

   async saveUserInfromation(user){
       try{
        const result = await axios.put(API_BASE_URL + '/update' , user )
        return result.data.users
       }catch(e){
       
        return e.response.data;
       }
   }
}

export default new UserService();

and this is my component I call the function from class service to edit user

import React, { Component } from "react";

class Clientedit extends Component {
  constructor(props) {
    super(props);
    this.state = {
      user : {},
      oldPassword: "",
      newPassword: "",
      isLoading : true,
      error : "",
    };
  }

  componentDidMount() {
  }

   handleSubmit = (e) =>{
    e.preventDefault();
    let user = this.state.user;
    try{
      const res = UserService.saveUserInfromation(user);
    
    }
    catch(e){
      
    }
  }
  }
}
export default withParams(Clientedit);

when I log error from service class I get it in my consol enter image description here

but when I log it from my component I get nothing , any solution please

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You must set password_confirmation parameter when updating your password

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda