hedgedoc/src/initializers/configLoader.ts
Tilman Vatteroth 8636391a73 convert more promise chains to async await
Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
2020-05-24 23:59:02 +02:00

20 lines
No EOL
679 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 async function loadAllConfig() {
const frontendConfig = await getFrontendConfig();
if (!frontendConfig) {
return Promise.reject("Frontend config empty!");
}
setFrontendConfig(frontendConfig);
const backendConfig = await getBackendConfig()
if (!backendConfig) {
return Promise.reject("Backend config empty!");
}
setBackendConfig(backendConfig)
await getAndSetUser();
}