* Page for single contract

feature: #9
This commit is contained in:
2023-01-06 00:34:35 +01:00
parent 49cd7b2c72
commit 0fc5cbe8e8
11 changed files with 331 additions and 22 deletions

View File

@@ -1,20 +1,26 @@
import { getContracts } from '../service/getContracts'
import HttpClient from '../api/HttpClient'
import router from '../router'
import { getContracts, getContractById } from '../service/ContractsService'
export default {
state: () => ({
contracts: []
contracts: [],
currentContract: null
}),
mutations: {
initContracts(state, data) {
state.contracts = data
},
setCurrentContract(state, data) {
state.currentContract = data
}
},
actions: {
async fetchContracts({ commit }) {
const contracts = await getContracts()
commit('initContracts', contracts)
},
async fetchContractById({ commit }, id) {
const currentContract = await getContractById(id)
commit('setCurrentContract', currentContract)
}
},
getters: {}