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

108
Visualizações
SyntaxError: Unexpected identifier 'supabase'. Expected ';' after variable declaration

I am trying to delete a row from the database and when I load the page, the file throws an error saying SyntaxError: Unexpected identifier 'supabase'. Expected ';' after variable declaration.

Following is my function code:

window.deleteChap = async function deleteChap(x) {

  let chapid = chapids[x];

  Swal.fire({
    title: `Are you sure you want to delete the chapter? This action is irreversible.`,
    showCancelButton: true,
    confirmButtonText: 'Yes, delete it!',
  }).then((result) => {
    if (result.isConfirmed) {

      const { data, error } = await supabase.from('chapters').eq('id', chapid).delete();
      
      if (error) {
        erroralert(error.message);
      } else {
        successalert(`Chapter deleted successfully.`);
      }
    }
  })

}

The supabase client has already been initialised this way:

let supabase;
$.ajax({
    url: "/keys",
    success: async function( result ) {
  
        result = JSON.parse(result);
  
        supabase = createClient(result.link, result.anon_key);

  }});

The javascript file is linked to the html with <script defer src="/js/dnovelinfo.js" type="module"></script>

I am not sure why the error is being thrown, even when I haven't interacted with the page (the page was only reloaded to see latest changes)

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