mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 15:14:56 -04:00
convert more promise chains to async await
Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
parent
23cfcacd09
commit
8636391a73
2 changed files with 18 additions and 29 deletions
|
@ -3,22 +3,18 @@ import {setFrontendConfig} from "../redux/frontend-config/methods";
|
|||
import {setBackendConfig} from "../redux/backend-config/methods";
|
||||
import {getAndSetUser} from "../utils/apiUtils";
|
||||
|
||||
export function loadAllConfig() {
|
||||
return getFrontendConfig()
|
||||
.then((frontendConfig) => {
|
||||
if (!frontendConfig) {
|
||||
return Promise.reject("Frontend config empty!");
|
||||
}
|
||||
setFrontendConfig(frontendConfig);
|
||||
return getBackendConfig()
|
||||
})
|
||||
.then((backendConfig) => {
|
||||
if (!backendConfig) {
|
||||
return Promise.reject("Backend config empty!");
|
||||
}
|
||||
setBackendConfig(backendConfig)
|
||||
}).then(() => {
|
||||
getAndSetUser();
|
||||
})
|
||||
}
|
||||
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();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue