mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 14:44:43 -04:00
20 lines
728 B
TypeScript
20 lines
728 B
TypeScript
import { getBackendConfig, getFrontendConfig } from '../api/config'
|
|
import { setFrontendConfig } from '../redux/frontend-config/methods'
|
|
import { setBackendConfig } from '../redux/backend-config/methods'
|
|
import { getAndSetUser } from '../utils/apiUtils'
|
|
|
|
export const loadAllConfig: (baseUrl: string) => Promise<void> = async (baseUrl) => {
|
|
const frontendConfig = await getFrontendConfig(baseUrl)
|
|
if (!frontendConfig) {
|
|
return Promise.reject(new Error('Frontend config empty!'))
|
|
}
|
|
setFrontendConfig(frontendConfig)
|
|
|
|
const backendConfig = await getBackendConfig()
|
|
if (!backendConfig) {
|
|
return Promise.reject(new Error('Backend config empty!'))
|
|
}
|
|
setBackendConfig(backendConfig)
|
|
|
|
await getAndSetUser()
|
|
}
|