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

144
Vistas
in frontend logon, ajax stays logged in but axios does not after page refresh

i'm trying to understand the difference between ajax and axios. i'm experimenting with two request methods for user login in react development using ajax and axios -- with all else being equal. when reloading the page after successful login using ajax, the user remains logged on, but when using axios, the user is no longer logged in after page refresh. is this difference expected?

loginPageAjax.js

componentDidMount() {
  $.ajax({
    method: 'GET',
    url: '/retrieveUser',
    success: (res) => {
    if (res.id) this.loginCheck(res);
    }
  });
}

loginPageAxios.js

componentDidMount() {
  axios({
    method: 'GET',
    url: '/retrieveUser'
  })
  .then(res => {
    if (res.id) this.loginCheck(res);
  })
}
about 4 years ago · Juan Pablo Isaza
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