Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
partido-interdimensional-pirata
lumi
la web de miniloom
Commits
094859bb
Commit
094859bb
authored
Feb 27, 2020
by
void
Browse files
manejar mejor casos de 422 y limpiar store.js
parent
21c47b25
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/store.js
View file @
094859bb
...
...
@@ -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`
,
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment