Use boolean values if value equals 'true' or 'false'
This commit is contained in:
parent
15730cb733
commit
9c6acae0cf
2 changed files with 13 additions and 3 deletions
|
@ -1,5 +1,14 @@
|
|||
import _ from 'lodash'
|
||||
|
||||
export const getBooleanValue = value => {
|
||||
if (value === 'true') {
|
||||
return true
|
||||
} else if (value === 'false') {
|
||||
return false
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
export const checkPartialUpdate = (settings, updatedSettings, description) => {
|
||||
return Object.keys(updatedSettings).reduce((acc, group) => {
|
||||
acc[group] = Object.keys(updatedSettings[group]).reduce((acc, key) => {
|
||||
|
|
|
@ -132,7 +132,7 @@ import {
|
|||
RateLimitInput,
|
||||
RegInvitesInput,
|
||||
SelectInputWithReducedLabels } from './inputComponents'
|
||||
import { processNested } from '@/store/modules/normalizers'
|
||||
import { getBooleanValue, processNested } from '@/store/modules/normalizers'
|
||||
import _ from 'lodash'
|
||||
import marked from 'marked'
|
||||
|
||||
|
@ -332,9 +332,10 @@ export default {
|
|||
)
|
||||
},
|
||||
update(value, group, key, parents, input, type, nested) {
|
||||
const updatedValue = getBooleanValue(value)
|
||||
nested
|
||||
? this.processNestedData(value, group, key, parents)
|
||||
: this.updateSetting(value, group, key, input, type)
|
||||
? this.processNestedData(updatedValue, group, key, parents)
|
||||
: this.updateSetting(updatedValue, group, key, input, type)
|
||||
},
|
||||
updateSetting(value, group, key, input, type) {
|
||||
this.$store.dispatch('UpdateSettings', { group, key, input, value, type })
|
||||
|
|
Loading…
Reference in a new issue