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

184
Visualizações
Why does my electron/react project redirect to the next window location then go back to the previous page?

I am using React with Electron and have a login page that is supposed to send the user to the next page when the fields are filled out. I am using the ipcRender to send information to ipcMain. When ipcMain responds back with true, the page should go to the next page. It does this for a second then goes back to the login page and I am really not sure why.

Here is the code I am using for the login page


    function handleRedirect(event){
            ipcRenderer.send(channels.GET_LOGIN, event.target[0].value,event.target[1].value);
            ipcRenderer.on(channels.GET_LOGIN, (event,arg) => {
                console.log(arg)
                if (arg === true){ 
                    console.log("heading on")
                    window.location.hash = "/nextPage";  
                }
                else{
                    window.location.hash="/login"
                }
            });
        }

Here is the code for the electron main.js


    ipcMain.on(channels.GET_LOGIN, async(event,arg,val) => {
      const db = new sqlite.Database('donationDb.db', (err) => {
        if (err) {
          console.error(err.message);
        }
        console.log('Connected to the database.');
      });
      db.run('CREATE TABLE IF NOT EXISTS login(username text, password text)', (err) => {
        if (err) {
            console.log(err);
            throw err;
        }
      });
      console.log(val);
      event.sender.send(channels.GET_LOGIN, true);
      db.close();
    });

about 4 years ago · Juan Pablo Isaza
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