From 1cc103f098d334294d57b1972ae0d81e2a0e68a7 Mon Sep 17 00:00:00 2001 From: Matheus Costa Vieira Date: Thu, 2 Apr 2020 15:54:06 -0300 Subject: [PATCH] =?UTF-8?q?removido=20l=C3=B3gica=20de=20categorias?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _includes/estabelecimento/load.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/_includes/estabelecimento/load.js b/_includes/estabelecimento/load.js index 68fbc05..44c14bc 100644 --- a/_includes/estabelecimento/load.js +++ b/_includes/estabelecimento/load.js @@ -1,6 +1,7 @@ window.addEventListener("load", function(event) { - const url = "{{ 'assets/json/estabelecimentos.json' | relative_url }}"; - fetch(url, { cache: "no-cache" }) + fetch("{{ 'assets/json/estabelecimentos.json' | relative_url }}", { + cache: "no-cache" + }) .then(r => r.json()) .then(r => { const list = []; @@ -18,11 +19,6 @@ window.addEventListener("load", function(event) { }); return list; }) - .then(list => { - const categs = Array.from(new Set(list.flatMap(e => e.Categoria))); - categoriasController.refresh(categs); - return list; - }) .then(list => { const estabelecimento = solicitacao.getEstabelecimento(); if (estabelecimento) { @@ -34,6 +30,12 @@ window.addEventListener("load", function(event) { selecionado && (txtEstabelecimento.value = selecionado.id); } }); + + fetch("{{ 'assets/json/categorias.json' | relative_url }}", { + cache: "no-cache" + }) + .then(r => r.json()) + .then(categoriasController.refresh); }); txtEstabelecimento.addEventListener("change", function name(ev) { const estabelecimento = estabelecimentoController.get("id", this.value);