Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
fix(proposals): 404 on non-existing proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
vhf committed Nov 18, 2019
1 parent 7763358 commit c87e7aa
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
6 changes: 6 additions & 0 deletions pages/proposal/_id.vue
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ export default {
this.readonly = true
}
})
.catch(() => {
return this.$router.app.error({
statusCode: 404,
message: 'Not found'
})
})
}, 200)
}
},
Expand Down
6 changes: 6 additions & 0 deletions pages/proposal/class.vue
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ export default {
})
}
})
.catch(() => {
return this.$router.app.error({
statusCode: 404,
message: 'Not found'
})
})
}, 200)
}
else {
Expand Down
6 changes: 6 additions & 0 deletions pages/proposal/property.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ export default {
})
}
})
.catch(() => {
return this.$router.app.error({
statusCode: 404,
message: 'Not found'
})
})
}, 200)
}
else {
Expand Down
8 changes: 5 additions & 3 deletions store/prop.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,17 @@ export const actions = {
})

const proposal = result.data.proposal
if (!_get(proposal, 'proposalObject')) {
throw new Error('Not found')
}
const deserialized = this.$proposalDeserializer(proposal.proposalObject)

commit(LOAD, deserialized)
commit(SET_ID, proposal.id)
return Promise.resolve(proposal.isDraft)
return proposal.isDraft
}
catch (error) {
console.error(error)
return Promise.reject(error)
throw error
}
},
async [SAVE] ({ dispatch, commit, state }) {
Expand Down

0 comments on commit c87e7aa

Please sign in to comment.