FIX: Remove login for API

This commit is contained in:
2023-11-25 00:55:31 -03:00
parent 3cadaca746
commit ec7d8e69ab
34 changed files with 140 additions and 71 deletions

View File

@ -51,7 +51,7 @@
get() {
return {
start: () => {
return fetch('{{$urls->api}}/proyecto/' + this.id + '/inicio').then(response => {
return fetchAPI('{{$urls->api}}/proyecto/' + this.id + '/inicio').then(response => {
if (response.ok) {
return response.json()
}
@ -60,7 +60,7 @@
})
},
current: () => {
return fetch('{{$urls->api}}/proyecto/' + this.id + '/estado').then(response => {
return fetchAPI('{{$urls->api}}/proyecto/' + this.id + '/estado').then(response => {
if (response.ok) {
return response.json()
}
@ -69,7 +69,7 @@
})
},
recepcion: () => {
return fetch('{{$urls->api}}/proyecto/' + this.id + '/recepcion').then(response => {
return fetchAPI('{{$urls->api}}/proyecto/' + this.id + '/recepcion').then(response => {
if (response.ok) {
if (response.status === 204) {
return null

View File

@ -134,7 +134,7 @@
return {
superficies: () => {
const url = '{{$urls->api}}/proyecto/{{$proyecto->id}}/superficies/vendible'
return fetch(url).then(response => {
return fetchAPI(url).then(response => {
if (response.ok) {
return response.json()
}
@ -197,7 +197,7 @@
data: {},
get: function() {
const url = '{{$urls->api}}/proyecto/{{$proyecto->id}}/unidades'
return fetch(url).then(response => {
return fetchAPI(url).then(response => {
if (response.ok) {
return response.json()
}
@ -273,7 +273,7 @@
return {
ventas: () => {
const url = '{{$urls->api}}/ventas'
return fetch(url, {method: 'post', headers: {'Content-Type': 'application/json'},
return fetchAPI(url, {method: 'post', headers: {'Content-Type': 'application/json'},
body: JSON.stringify({proyecto_id: '{{$proyecto->id}}'})}).then(response => {
if (response.ok) {
return response.json()
@ -294,7 +294,7 @@
},
stock: () => {
const url = '{{$urls->api}}/proyecto/{{$proyecto->id}}/unidades/disponibles'
return fetch(url).then(response => {
return fetchAPI(url).then(response => {
if (response.ok) {
return response.json()
}
@ -315,7 +315,7 @@
},
venta: venta_id => {
const url = '{{$urls->api}}/venta/' + venta_id
return fetch(url).then(response => {
return fetchAPI(url).then(response => {
if (response.ok) {
return response.json()
}
@ -325,7 +325,7 @@
},
precio: unidad_id => {
const url = '{{$urls->api}}/ventas/precio/unidad/' + unidad_id
return fetch(url).then(response => {
return fetchAPI(url).then(response => {
if (response.ok) {
if (response.status === 204) {
return null

View File

@ -203,7 +203,7 @@
return {
tipos: proyecto_id => {
const url = '{{$urls->api}}/proyecto/' + proyecto_id + '/unidades/tipos'
return fetch(url).then(response => {
return fetchAPI(url).then(response => {
if (response.ok) {
return response.json()
}