Add version checker

This commit is contained in:
advplyr 2021-09-15 17:59:38 -05:00
parent a56b3a8096
commit bd0e8518be
7 changed files with 120 additions and 5 deletions

View file

@ -1,6 +1,7 @@
import Vue from 'vue'
import { checkForUpdate } from '@/plugins/version'
export const state = () => ({
versionData: null,
serverSettings: null,
streamAudiobook: null,
editModalTab: 'details',
@ -39,10 +40,24 @@ export const actions = {
console.error('Failed to update server settings', error)
return false
})
},
checkForUpdate({ commit }) {
return checkForUpdate()
.then((res) => {
commit('setVersionData', res)
return res
})
.catch((error) => {
console.error('Update check failed', error)
return false
})
}
}
export const mutations = {
setVersionData(state, versionData) {
state.versionData = versionData
},
setServerSettings(state, settings) {
state.serverSettings = settings
},