aboutsummaryrefslogtreecommitdiffstats
path: root/code/app/src/lib/configuration.ts
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2022-10-05 14:45:21 +0200
committerivarlovlie <git@ivarlovlie.no>2022-10-05 14:45:21 +0200
commitb7e39b59fd0fc7b5610ebff29035bf622079e0d8 (patch)
tree64be84ebbdac9f7ceced983390c53b10d575af5c /code/app/src/lib/configuration.ts
parent2001c035fbb417ab0a3d42cfb04d17420bde4086 (diff)
downloadgreatoffice-b7e39b59fd0fc7b5610ebff29035bf622079e0d8.tar.xz
greatoffice-b7e39b59fd0fc7b5610ebff29035bf622079e0d8.zip
refactor: Change file structure
Diffstat (limited to 'code/app/src/lib/configuration.ts')
-rw-r--r--code/app/src/lib/configuration.ts60
1 files changed, 60 insertions, 0 deletions
diff --git a/code/app/src/lib/configuration.ts b/code/app/src/lib/configuration.ts
new file mode 100644
index 0000000..5a6a1bf
--- /dev/null
+++ b/code/app/src/lib/configuration.ts
@@ -0,0 +1,60 @@
+export const BASE_DOMAIN = "dev.greatoffice.app";
+export const DEV_BASE_DOMAIN = "http://localhost";
+export const API_ADDRESS = "https://api." + BASE_DOMAIN;
+export const DEV_API_ADDRESS = "http://localhost:5000";
+export const SECONDS_BETWEEN_SESSION_CHECK = 600;
+
+export function api_base(path: string = ""): string {
+ return (is_development() ? DEV_API_ADDRESS : API_ADDRESS) + (path !== "" ? "/" + path : "");
+}
+
+export function is_development(): boolean {
+ return import.meta.env.DEV;
+}
+
+export function is_testing(): boolean {
+ return import.meta.env.VITE_TESTING;
+}
+
+export function is_debug(): boolean {
+ return localStorage.getItem(StorageKeys.debug) !== "true";
+}
+
+export const CookieNames = {
+ theme: "go_theme",
+ locale: "go_locale",
+ session: "go_session"
+};
+
+export function get_test_context(): TestContext {
+ return {
+ user: {
+ username: import.meta.env.VITE_TEST_USERNAME,
+ password: import.meta.env.VITE_TEST_PASSWORD
+ }
+ }
+}
+
+export interface TestContext {
+ user: {
+ username: string,
+ password: string
+ }
+}
+
+export const QueryKeys = {
+ labels: "labels",
+ categories: "categories",
+ entries: "entries",
+};
+
+export const StorageKeys = {
+ session: "sessionData",
+ theme: "theme",
+ debug: "debug",
+ categories: "categories",
+ labels: "labels",
+ entries: "entries",
+ stopwatch: "stopwatchState",
+ logLevel: "logLevel"
+}; \ No newline at end of file