mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-08 22:50:00 +08:00
reject if server configuration is not available
This commit is contained in:
parent
7a611e30d7
commit
cb7b050081
1 changed files with 6 additions and 1 deletions
|
@ -4,7 +4,11 @@ import { promiseWithResolvers } from "../utils/misc";
|
|||
|
||||
let config: Configuration | undefined = undefined;
|
||||
|
||||
const { promise: configPromise, resolve } = promiseWithResolvers<boolean>();
|
||||
const {
|
||||
promise: configPromise,
|
||||
resolve,
|
||||
reject,
|
||||
} = promiseWithResolvers<boolean>();
|
||||
|
||||
export { configPromise };
|
||||
|
||||
|
@ -17,6 +21,7 @@ export async function sync(): Promise<void> {
|
|||
|
||||
if (response.status !== 200) {
|
||||
console.error("Could not fetch configuration", response.body.message);
|
||||
reject("cannot load configuration");
|
||||
return;
|
||||
} else {
|
||||
config = response.body.data ?? undefined;
|
||||
|
|
Loading…
Add table
Reference in a new issue