chore: import the store directly to update the config
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
0609b35c9b
commit
817372b751
|
@ -94,7 +94,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const url = await checkAndSetApiUrl(this.apiUrl, () => this.$store.dispatch('config/update'))
|
const url = await checkAndSetApiUrl(this.apiUrl)
|
||||||
|
|
||||||
if (url === '') {
|
if (url === '') {
|
||||||
// If the config setter function could not figure out a url
|
// If the config setter function could not figure out a url
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
|
import {store} from '@/store'
|
||||||
|
|
||||||
const API_DEFAULT_PORT = '3456'
|
const API_DEFAULT_PORT = '3456'
|
||||||
|
|
||||||
export const ERROR_NO_API_URL = 'noApiUrlProvided'
|
export const ERROR_NO_API_URL = 'noApiUrlProvided'
|
||||||
|
|
||||||
export const checkAndSetApiUrl = (url: string, updateConfig: () => Promise<void>): Promise<string> => {
|
const updateConfig = () => store.dispatch('config/update')
|
||||||
|
|
||||||
|
export const checkAndSetApiUrl = (url: string): Promise<string> => {
|
||||||
// Check if the url has an http prefix
|
// Check if the url has an http prefix
|
||||||
if (
|
if (
|
||||||
!url.startsWith('http://') &&
|
!url.startsWith('http://') &&
|
||||||
|
|
|
@ -144,7 +144,7 @@ export const store = createStore({
|
||||||
commit(CURRENT_LIST, currentList)
|
commit(CURRENT_LIST, currentList)
|
||||||
},
|
},
|
||||||
async loadApp({commit, dispatch}) {
|
async loadApp({commit, dispatch}) {
|
||||||
await checkAndSetApiUrl(window.API_URL, () => dispatch('config/update'))
|
await checkAndSetApiUrl(window.API_URL)
|
||||||
await dispatch('auth/checkAuth')
|
await dispatch('auth/checkAuth')
|
||||||
commit('vikunjaReady', true)
|
commit('vikunjaReady', true)
|
||||||
},
|
},
|
||||||
|
|
Reference in New Issue