feat: simplify config mutation (#1498)
Co-authored-by: Dominik Pschenitschni <mail@celement.de> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/1498 Reviewed-by: konrad <k@knt.li> Co-authored-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de> Co-committed-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
This commit is contained in:
parent
83d6f30d2d
commit
1e0607cb86
1 changed files with 4 additions and 24 deletions
|
@ -44,35 +44,15 @@ export default {
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
[CONFIG](state, config) {
|
[CONFIG](state, config) {
|
||||||
state.version = config.version
|
Object.assign(state, config)
|
||||||
state.frontendUrl = config.frontend_url
|
|
||||||
state.motd = config.motd
|
|
||||||
state.linkSharingEnabled = config.link_sharing_enabled
|
|
||||||
state.maxFileSize = config.max_file_size
|
|
||||||
state.registrationEnabled = config.registration_enabled
|
|
||||||
state.availableMigrators = config.available_migrators
|
|
||||||
state.taskAttachmentsEnabled = config.task_attachments_enabled
|
|
||||||
state.totpEnabled = config.totp_enabled
|
|
||||||
state.enabledBackgroundProviders = config.enabled_background_providers
|
|
||||||
state.legal.imprintUrl = config.legal.imprint_url
|
|
||||||
state.legal.privacyPolicyUrl = config.legal.privacy_policy_url
|
|
||||||
state.caldavEnabled = config.caldav_enabled
|
|
||||||
state.userDeletionEnabled = config.user_deletion_enabled
|
|
||||||
state.taskCommentsEnabled = config.task_comments_enabled
|
|
||||||
const auth = objectToCamelCase(config.auth)
|
|
||||||
state.auth.local.enabled = auth.local.enabled
|
|
||||||
state.auth.openidConnect.enabled = auth.openidConnect.enabled
|
|
||||||
state.auth.openidConnect.redirectUrl = auth.openidConnect.redirectUrl
|
|
||||||
state.auth.openidConnect.providers = auth.openidConnect.providers
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async update(ctx) {
|
async update(ctx) {
|
||||||
const HTTP = HTTPFactory()
|
const HTTP = HTTPFactory()
|
||||||
|
const {data: config} = await HTTP.get('info')
|
||||||
const {data: info} = await HTTP.get('info')
|
ctx.commit(CONFIG, objectToCamelCase(config))
|
||||||
ctx.commit(CONFIG, info)
|
return config
|
||||||
return info
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
Loading…
Reference in a new issue