|
|
@@ -44,16 +44,18 @@ export const actions = {
|
|
|
.then(response => {
|
|
|
commit('storeInfo/GET_COMMODITY_SUCCESS', response.data)
|
|
|
let commodity = response.data || {}
|
|
|
- commit('storeInfo/REQUEST_COMPONENT')
|
|
|
- return axios.get(`/api/commodity/component/${commodity.uuid}`)
|
|
|
- .then(response => {
|
|
|
- commit('storeInfo/GET_COMPONENT_SUCCESS', response.data)
|
|
|
- return Promise.all([
|
|
|
- findStoreInfoFromUuid({ commit }, {uuid: commodity.storeid})
|
|
|
- ])
|
|
|
- }, err => {
|
|
|
- commit('storeInfo/GET_COMPONENT_FAILURE', err)
|
|
|
- })
|
|
|
+ if(commodity.uuid) {
|
|
|
+ commit('storeInfo/REQUEST_COMPONENT')
|
|
|
+ return axios.get(`/api/commodity/component/${commodity.uuid}`)
|
|
|
+ .then(response => {
|
|
|
+ commit('storeInfo/GET_COMPONENT_SUCCESS', response.data)
|
|
|
+ return Promise.all([
|
|
|
+ findStoreInfoFromUuid({ commit }, {uuid: commodity.storeid})
|
|
|
+ ])
|
|
|
+ }, err => {
|
|
|
+ commit('storeInfo/GET_COMPONENT_FAILURE', err)
|
|
|
+ })
|
|
|
+ }
|
|
|
}, err => {
|
|
|
commit('storeInfo/GET_COMMODITY_FAILURE', err)
|
|
|
})
|