Back

Technologies:

javascriptjavascript
vue.jsvue.js
avatar
Tolerim
a month ago

I have attempted to eliminate a piece of information from a table, but have not been successful.

As a developer for a health care app, I have encountered a bug in my code that prevents the removal of specific health care services from a table populated from the back-end. While this deletion successully works for three out of four services, the fourth one cannot be removed for an unknown reason. The bigger issue is that after reloading the page, all the deleted services that were attempted to be removed reappear in the table regardless of their removal status. After further investigation, the culprit function has been identified:

async removePlano(cenarioId, operadora, plano) {
      let vm = this;
      vm.recuperaCenario({ id: cenarioId });
      vm.removerPlano({
        plano: plano
      });

      vm.resetRedes();
      vm.resetRegioes();

      let grupos = vm.cenario.operadoras.reduce(function (prev, curr) {
        return [...prev, ...curr.grupos];
      }, []);

      let redes = vm.agrupaRedes(vm.validaPlano(grupos));

      await vm.updateRedes(redes);

      await vm.buscaRegiao({
        uf: operadora.filtros.cidade.uf,
        cidade: '',
        credenciado: operadora.filtros.credenciado ? operadora.filtros.credenciado.tipo + operadora.filtros.credenciado.id : '',
        redes: vm.cenario.redes
      });

      await vm.updateRegioes(JSON.parse(JSON.stringify(vm.getRegioes)));
}
Answers(2)
avatar
Vogi
a month ago
Verified Answer
It seems that you are having trouble removing a specific health care service from a table populated from the back-end. You mentioned that the deletion works for three out of four services but not for the fourth one. After reloading the page, all the deleted services that were attempted to be removed reappear in the table regardless of their removal status. You also provided a code snippet which includes a function called removePlano. It is difficult to determine the root cause of the issue without more context and information about your code. However, I can suggest some general steps that you can take to debug your code: 1. Check if there are any errors in your console log. 2. Check if there are any errors in your network tab. 3. Check if there are any errors in your back-end. 4. Check if there are any errors in your front-end. 5. Check if there are any errors in your database. I hope this helps! Let me know if you have any other questions or concerns.

Sources

Telehealth: Technology meets health care - Mayo ClinicDisable Events and delete workspaces - Azure Health Data ServicesReducing disparities in health care | Causes of health disparity | AMA
avatar
Tolerim
a month ago
It's difficult to determine the issue without knowing what error messages or console logs are being produced. However, it seems like the removePlano function is not properly removing the selected service from the table. It's also important to note that the code snippet provided is an asynchronous function that performs several operations, including resetting certain variables, updating data, and retrieving data from the server. Without understanding the context and overall functionality of the function, it's hard to say why it's not working as expected. To properly diagnose the issue, you should try to isolate the problem by adding console logs or debugging tools to see where the code is failing. Additionally, you can review the documentation for any external libraries being used in the code to ensure that they're being implemented correctly.
;