Skip to content
Snippets Groups Projects
Commit 0172f426 authored by leandro's avatar leandro
Browse files

fix structure undefined

parent 285391d6
No related branches found
No related tags found
No related merge requests found
...@@ -253,28 +253,36 @@ export default { ...@@ -253,28 +253,36 @@ export default {
...mapState("feature", ["features", "features_count"]), ...mapState("feature", ["features", "features_count"]),
...mapState("feature_type", ["feature_types", "importFeatureTypeData"]), ...mapState("feature_type", ["feature_types", "importFeatureTypeData"]),
structure: function () { structure: function () {
if (this.feature_types) { if (Object.keys(this.feature_types).length) {
return this.feature_types.find( let st = this.feature_types.find(
(el) => el.slug === this.$route.params.feature_type_slug (el) => el.slug === this.$route.params.feature_type_slug
); );
if (st)
return st
} }
return {}; return {};
}, },
feature_type_features: function () { feature_type_features: function () {
return this.features.filter( if(this.features.length)
(el) => el.feature_type.slug === this.$route.params.feature_type_slug return this.features.filter(
); (el) => el.feature_type.slug === this.$route.params.feature_type_slug
);
return {}
}, },
lastFeatures: function () { lastFeatures: function () {
return this.feature_type_features.slice(0, 5); if (this.feature_type_features.length)
return this.feature_type_features.slice(0, 5);
return []
}, },
orderedCustomFields() { orderedCustomFields() {
return [...this.structure.customfield_set].sort( if (Object.keys(this.structure).length)
(a, b) => a.position - b.position return [...this.structure.customfield_set].sort(
); (a, b) => a.position - b.position
);
return {}
}, },
}, },
...@@ -386,7 +394,7 @@ export default { ...@@ -386,7 +394,7 @@ export default {
limit: '5' limit: '5'
}) })
console.log(response) // console.log(response)
if (response){ if (response){
this.featuresLoading = false; this.featuresLoading = false;
} }
...@@ -394,8 +402,7 @@ export default { ...@@ -394,8 +402,7 @@ export default {
}, },
watch:{ watch:{
'structure'(newValue){ 'structure'(newValue){
console.log(newValue) if (newValue.slug){
if (newValue){
this.$store.dispatch("feature_type/GET_IMPORTS", this.structure.slug); this.$store.dispatch("feature_type/GET_IMPORTS", this.structure.slug);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment