Skip to content

Commit

Permalink
notificationRefreshTime default value 30sec #562
Browse files Browse the repository at this point in the history
  • Loading branch information
schefbi committed Jan 19, 2024
1 parent 1535dd3 commit 7521e25
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/components/Header/NotificationsToggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ import {
} from "../../utils/fetch.ts";
import { theme } from "../../utils/theme.ts";
import { NotificationsDropdown } from "./NotificationsDropdown.ts";
import { log } from "../../utils/logging.ts";

const envSettings = getEnvSettings();
if (typeof envSettings?.notificationRefreshTime !== "number") {
throw new Error("Invalid 'notificationRefreshTime' setting");
log("Invalid 'notificationRefreshTime' setting default set to 30sec");
envSettings.notificationRefreshTime = 30
}

export enum NotificationsState {
Expand Down
10 changes: 7 additions & 3 deletions src/env-settings.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
export type EnvSettings = Readonly<{
/**
* EnvSettings with Readonly<> they must set in settings.js
* every other EnvSettings have default value and set log entry if not set
*/
export type EnvSettings = {
apiServer: Readonly<string>;
oAuthServer: Readonly<string>;
oAuthPrefix: Readonly<string>;
oAuthClientId: Readonly<string>;
notificationRefreshTime: Readonly<number>;
}>;
notificationRefreshTime: number;
};

/**
* Returns the environment specific settings as defined in
Expand Down

0 comments on commit 7521e25

Please sign in to comment.