Move server settings and SSO settings to settings.js module & cleanup sso.vue

This commit is contained in:
advplyr 2022-02-10 18:24:20 -06:00
parent 5060e0b728
commit c34a518754
21 changed files with 132 additions and 283 deletions

View file

@ -3,7 +3,6 @@ import Vue from 'vue'
export const state = () => ({
versionData: null,
serverSettings: null,
streamAudiobook: null,
editModalTab: 'details',
showEditModal: false,
@ -28,14 +27,6 @@ export const getters = {
getIsAudiobookSelected: state => audiobookId => {
return !!state.selectedAudiobooks.includes(audiobookId)
},
getServerSetting: state => key => {
if (!state.serverSettings) return null
return state.serverSettings[key]
},
getBookCoverAspectRatio: state => {
if (!state.serverSettings || !state.serverSettings.coverAspectRatio) return 1.6
return state.serverSettings.coverAspectRatio === 0 ? 1.6 : 1
},
getNumAudiobooksSelected: state => state.selectedAudiobooks.length,
getAudiobookIdStreaming: state => {
return state.streamAudiobook ? state.streamAudiobook.id : null
@ -43,22 +34,6 @@ export const getters = {
}
export const actions = {
updateServerSettings({ commit }, payload) {
var updatePayload = {
...payload
}
return this.$axios.$patch('/api/serverSettings', updatePayload).then((result) => {
if (result.success) {
commit('setServerSettings', result.serverSettings)
return true
} else {
return false
}
}).catch((error) => {
console.error('Failed to update server settings', error)
return false
})
},
checkForUpdate({ commit }) {
return checkForUpdate()
.then((res) => {
@ -102,10 +77,6 @@ export const mutations = {
setVersionData(state, versionData) {
state.versionData = versionData
},
setServerSettings(state, settings) {
if (!settings) return
state.serverSettings = settings
},
setStreamAudiobook(state, audiobook) {
state.playOnLoad = true
state.streamAudiobook = audiobook