Cleanup logs, fixed add Venta, fixed search
This commit is contained in:
@ -107,9 +107,10 @@
|
||||
const uri = '{{$urls->api}}/search'
|
||||
this.data = []
|
||||
return fetchAPI(uri, {method: 'post', body: data}).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
if (!response) {
|
||||
return
|
||||
}
|
||||
return response.json()
|
||||
}).catch(error => {
|
||||
this.draw().clear()
|
||||
this.draw().error(error)
|
||||
@ -123,7 +124,11 @@
|
||||
const promises = []
|
||||
data.results.forEach(row => {
|
||||
if (row.tipo === 'venta') {
|
||||
promises.push(this.get().venta(row.id).then(json => {
|
||||
return promises.push(this.get().venta(row.id).then(json => {
|
||||
if (json.venta === null) {
|
||||
console.debug(json)
|
||||
return
|
||||
}
|
||||
const venta = json.venta
|
||||
progress.progress('increment')
|
||||
const r = new Row({unidad: venta.propiedad.unidades[0], proyecto: venta.proyecto})
|
||||
@ -134,7 +139,6 @@
|
||||
console.error(row)
|
||||
console.error(error)
|
||||
}))
|
||||
return
|
||||
}
|
||||
promises.push(this.get().unidad(row.id).then(json => {
|
||||
const unidad = json.unidad
|
||||
@ -164,9 +168,10 @@
|
||||
venta: id => {
|
||||
const url = '{{$urls->api}}/venta/' + id
|
||||
return fetchAPI(url).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
if (!response) {
|
||||
return
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user