app/javascript/vue/tasks/loans/new/store/actions/loadLoan.js
import { MutationNames } from '../mutations/mutations'
import { Loan } from '@/routes/endpoints'
import ActionNames from './actionNames'
export default ({ commit, state, dispatch }, id) => {
commit(MutationNames.SetLoading, true)
return Loan.find(id, { extend: ['roles'] }).then((response) => {
commit(MutationNames.SetLoading, false)
commit(MutationNames.SetLoan, response.body)
dispatch(ActionNames.LoadLoanItems, { loanId: id })
})
}