Hello! We are running our annual fundraising. Please consider making a donation if you value this freely available service or want to support people around the world working towards liberatory social change. https://riseup.net/donate.

Commit 094859bb authored by void's avatar void
Browse files

manejar mejor casos de 422 y limpiar store.js

parent 21c47b25
......@@ -47,8 +47,15 @@ export const request = async (path, settings = {}) => {
throw 'not_found'
}
if (response.status === 422) {
// throw 'unprocessable_entity'
// devolver el JSON normalmente, deberia contener el error
let error
try {
const json = await response.json()
if (json.errors) error = json.errors
else throw null
} catch (error) {
error = 'unprocessable_entity'
}
throw error
}
}
......@@ -201,9 +208,6 @@ const store = new Vuex.Store({
parseJson: false,
})
commit('abordadaBarca', barcaId)
//if (json.errors) throw json.errors
//console.log(json)
//return json
},
async crearBarca({ commit }, body) {
const json = await request(`/barcas`, {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment