mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-06 13:40:16 +08:00
dont fail initDb if friends endpoints are disabled
This commit is contained in:
parent
4280585ac6
commit
57370d5e7e
3 changed files with 9 additions and 7 deletions
|
@ -157,7 +157,6 @@
|
|||
<i class="fas fa-fw fa-chart-line"></i>
|
||||
User stats
|
||||
</a>
|
||||
<!-- TODO: disable if configuration is not set for friends -->
|
||||
<a
|
||||
href="/friends"
|
||||
class="button goToFriends"
|
||||
|
|
|
@ -6,7 +6,7 @@ import { isFunboxActive } from "../test/funbox/list";
|
|||
import * as TestState from "../test/test-state";
|
||||
import * as Notifications from "../elements/notifications";
|
||||
import { LoadingOptions } from "../pages/page";
|
||||
//import { get as getServerOptions } from "../ape/server-configuration";
|
||||
import { get as getServerConfiguration } from "../ape/server-configuration";
|
||||
|
||||
//source: https://www.youtube.com/watch?v=OstALBk-jTc
|
||||
// https://www.youtube.com/watch?v=OstALBk-jTc
|
||||
|
@ -156,13 +156,13 @@ const routes: Route[] = [
|
|||
await navigate("/login", options);
|
||||
return;
|
||||
}
|
||||
//timing issue, not there yet
|
||||
/* if (!getServerOptions()?.friends.enabled) {
|
||||
console.log("### route friends not enabled");
|
||||
//timing issue, on initial load the serverconfiguration not there yet
|
||||
const serverConfiguration = getServerConfiguration();
|
||||
if (serverConfiguration && !getServerConfiguration()?.friends.enabled) {
|
||||
await navigate("/", options);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
await PageController.change("friends", options);
|
||||
},
|
||||
},
|
||||
|
|
|
@ -31,6 +31,7 @@ import { FunboxMetadata } from "../../../packages/funbox/src/types";
|
|||
import { getFirstDayOfTheWeek } from "./utils/date-and-time";
|
||||
import { Language } from "@monkeytype/schemas/languages";
|
||||
import * as AuthEvent from "./observables/auth-event";
|
||||
import { get as getServerConfiguration } from "./ape/server-configuration";
|
||||
|
||||
let dbSnapshot: Snapshot | undefined;
|
||||
const firstDayOfTheWeek = getFirstDayOfTheWeek();
|
||||
|
@ -90,7 +91,9 @@ export async function initSnapshot(): Promise<Snapshot | false> {
|
|||
Ape.users.get(),
|
||||
Ape.configs.get(),
|
||||
Ape.presets.get(),
|
||||
Ape.friends.getRequests(),
|
||||
getServerConfiguration()?.friends.enabled
|
||||
? Ape.friends.getRequests()
|
||||
: { status: 200, body: { message: "", data: [] } },
|
||||
]);
|
||||
|
||||
if (userResponse.status !== 200) {
|
||||
|
|
Loading…
Add table
Reference in a new issue