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

187
Vistas
Sometimes OK button doesn't work in alert in Vue page, what will be the problem?

I made a button to use an api to restart an application

That button works well. However, when it comes to alert popup, OK button sometimes doen't work. Even I click and click again, it doesn't close the alert popup. If I click it again after waiting a little moment like three seconds, then it close the alert popup normally. I don't know what will be the real problem, because I didn't experience this before. Can it be a browser(chrome)'s problem? Or vue framework's or nuxt framework's? I use nuxt framework in this code.

The code is below

restartApp.vue

<template>
    <button>restart</button>
</template>
<script>
import {
  createRestart
} from '@/api/agent'
export default {    
    methods:{
        restart() {
            if (confirm('Restart agent?')) {
                createRestart().then((res) => {
                    if (res.status == 200) {
                        alert('Agent is restarted')
                    }else{
                        alert("Agent isn't restarted")
                    }
                }).catch((err)=>{
                    alert('Agent has a error to restart >>', err)
                })
            }
        },
    }
}
</script>

@/api/agent.js

import axios from "axios";
import { headers } from "../config/env";

export function createRestart() {
  return axios.post("/api/agent/schedule/restart", {}, { headers });
}

/api.js

//(...)
router.post('/agent/schedule/restart', async (req, res) => {
    const axiosInstance = axios.create({ timeout:3000 });
    try {
      const result = await axiosInstance.post(
        "http://agentUrl" + '/v1/restart',
        {},
        config
      )
      res.json(result.data)
    } catch (err) {
      console.log(err)
      res.sendStatus(500)
    }
})
//(...)
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