diff --git a/src/service/ContractsService.js b/src/service/ContractsService.js index 770cfd8..6e1d0b5 100644 --- a/src/service/ContractsService.js +++ b/src/service/ContractsService.js @@ -28,6 +28,7 @@ export async function getContractById(identifier) { return resp.data }) .catch(error => { + console.error(error) router.push('/error?message=' + error.message + '&code=' + error.code) }) } diff --git a/src/store/contracts.module.js b/src/store/contracts.module.js index 4676d7d..07f31c4 100644 --- a/src/store/contracts.module.js +++ b/src/store/contracts.module.js @@ -18,10 +18,15 @@ export default { const contracts = await getContracts() commit('initContracts', contracts) }, - async fetchContractById({ commit }, id) { - const currentContract = await getContractById(id) - commit('setCurrentContract', currentContract) + async fetchContractById({ commit, state }, id) { + const contract = await getContractById(id) + commit('setCurrentContract', contract) + return state.currentContract } }, - getters: {} + getters: { + currentContract: state => { + return state.currentContract + } + } } diff --git a/src/views/ContractView.vue b/src/views/ContractView.vue index 0e96eff..083d117 100644 --- a/src/views/ContractView.vue +++ b/src/views/ContractView.vue @@ -1,7 +1,7 @@ \ No newline at end of file