Fix parsing values that can be both strings and arrays

This commit is contained in:
Angelina Filippova 2020-06-27 02:10:47 +03:00
parent 05615cddf5
commit 070db1235a
2 changed files with 3 additions and 4 deletions

View file

@ -10,10 +10,6 @@
<setting :setting-group="corsPlug" :data="corsPlugData"/> <setting :setting-group="corsPlug" :data="corsPlugData"/>
</el-form> </el-form>
<el-divider v-if="corsPlug" class="divider thick-line"/> <el-divider v-if="corsPlug" class="divider thick-line"/>
<el-form ref="httpSignatures" :model="httpSignaturesData" :label-position="labelPosition" :label-width="labelWidth">
<setting :setting-group="httpSignatures" :data="httpSignaturesData"/>
</el-form>
<el-divider v-if="httpSignatures" class="divider thick-line"/>
<el-form ref="httpSecurityData" :model="httpSecurityData" :label-position="labelPosition" :label-width="labelWidth"> <el-form ref="httpSecurityData" :model="httpSecurityData" :label-position="labelPosition" :label-width="labelWidth">
<setting :setting-group="httpSecurity" :data="httpSecurityData"/> <setting :setting-group="httpSecurity" :data="httpSecurityData"/>
</el-form> </el-form>

View file

@ -228,6 +228,9 @@ export default {
return this.data.value ? this.data.value[this.setting.key] : [] return this.data.value ? this.data.value[this.setting.key] : []
} else if (this.setting.type === 'atom') { } else if (this.setting.type === 'atom') {
return this.data[this.setting.key] && this.data[this.setting.key][0] === ':' ? this.data[this.setting.key].substr(1) : this.data[this.setting.key] return this.data[this.setting.key] && this.data[this.setting.key][0] === ':' ? this.data[this.setting.key].substr(1) : this.data[this.setting.key]
} else if (Array.isArray(this.setting.type) &&
this.setting.type.find(el => Array.isArray(el) && el.includes('list'))) {
return typeof this.data[this.setting.key] === 'string' ? [this.data[this.setting.key]] : this.data[this.setting.key]
} else { } else {
return this.data[this.setting.key] return this.data[this.setting.key]
} }