1
0

feat: port config store to pinia

This commit is contained in:
Dominik Pschenitschni
2022-09-21 02:21:22 +02:00
parent 9e8c429864
commit a737fc5bc2
21 changed files with 93 additions and 68 deletions

View File

@ -1,10 +1,9 @@
import {store} from '@/store'
import {useConfigStore} from '@/stores/config'
const API_DEFAULT_PORT = '3456'
export const ERROR_NO_API_URL = 'noApiUrlProvided'
const updateConfig = () => store.dispatch('config/update')
export const checkAndSetApiUrl = (url: string): Promise<string> => {
if(url.startsWith('/')) {
@ -25,6 +24,9 @@ export const checkAndSetApiUrl = (url: string): Promise<string> => {
const oldUrl = window.API_URL
window.API_URL = urlToCheck.toString()
const configStore = useConfigStore()
const updateConfig = () => configStore.update()
// Check if the api is reachable at the provided url
return updateConfig()
.catch(e => {