Skip to content

Commit

Permalink
removido lógica de categorias
Browse files Browse the repository at this point in the history
  • Loading branch information
matheus-vieira committed Apr 2, 2020
1 parent 4105db9 commit 1cc103f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions _includes/estabelecimento/load.js
Original file line number Diff line number Diff line change
@@ -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 = [];
Expand All @@ -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) {
Expand All @@ -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);
Expand Down

0 comments on commit 1cc103f

Please sign in to comment.