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 279d7802 authored by librenau's avatar librenau 💬
Browse files

Merge branch 'master' of 0xacab.org:pip/miniloom/web

parents 2116f661 7e288ee3
......@@ -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`, {
......
<template>
<div class="consensos">
<div class="container">
<header>
<h1>{{ barca ? barca.nombre : 'Barca...' }}</h1>
<div class="buttons">
......@@ -28,7 +28,14 @@
</nav>
<h1 v-if="loading">Cargando...</h1>
<div v-else-if="error">
<h1>Error: {{ error }}</h1>
<template v-if="error === 'forbidden'">
<h2>No tenés permiso para acceder a esta barca.</h2>
<p>
Quizás probá
<router-link to="/barcas">andando para atrás</router-link>.
</p>
</template>
<h1 v-else>Error: {{ error }}</h1>
</div>
<template v-else-if="consensos.length > 0" v-for="consenso in consensos">
<consenso :consenso="consenso" :barcaId="barcaId" :key="consenso.id" />
......@@ -99,11 +106,12 @@ export default {
</script>
<style lang="sass" scoped>
.container
margin: 0 20px
header
display: flex
align-items: center
flex-wrap: wrap
margin: 0 20px
h1
margin: 0
font-size: 1em
......@@ -116,7 +124,7 @@ nav
flex-wrap: wrap
align-content: stretch
align-items: center
padding: 0.2em 1em
padding: 0.2em 0
background: var(--background)
.links
display: flex
......
......@@ -26,7 +26,10 @@
>A abordar</a
>
</nav>
<div class="lista-barcas" v-if="barcasFiltradas.length > 0">
<div
class="lista-barcas"
v-if="barcasFiltradas && barcasFiltradas.length > 0"
>
<barca
:barca="barca"
:key="barca.id"
......@@ -82,8 +85,11 @@ export default {
computed: {
...mapState(['barcas']),
barcasFiltradas() {
return this.barcas.filter(({ abordada }) =>
this.filtro === Filtros.ABORDADAS ? abordada : !abordada,
return (
this.barcas.length > 0 &&
this.barcas.filter(({ abordada }) =>
this.filtro === Filtros.ABORDADAS ? abordada : !abordada,
)
)
},
filtro() {
......
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