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

85
Visualizações
Need help sending DELETE request with firebase Rest API with Vuex

I'm trying to delete some information from firebase and having some trouble getting it to work.

What i'm trying to do is have the deleteRequest button delete the data pulled from the fetch link.

This is the button and method

<div class="actions">
  <base-button @click="deleteRequest">Delete</base-button>
  </div>

async deleteRequest() {
  await this.$store.dispatch('requests/deleteRequest', {
    email: this.email,
    message: this.message,
    artistId: this.$route.params.id,
  });

async deleteRequest(context, payload) {
    const removeRequest = {
        userEmail: payload.email,
        message: payload.message
    };
    const response = await fetch(`https://find-artist-d3495-default-rtdb.firebaseio.com/requests/${payload.artistId}.json`, {
        method: 'DELETE',
        body: JSON.stringify(removeRequest)
    });

    const responseData = response.json();

    if (!response.ok) {
        const error = new Error(responseData.message || 'Failed to send request.');
        throw error;
    }
    context.commit('deleteRequests', removeRequest);
},
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