aboutsummaryrefslogtreecommitdiffstats
path: root/code/app/src/configuration/index.ts
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2022-12-09 03:57:12 +0100
committerivarlovlie <git@ivarlovlie.no>2022-12-09 03:57:12 +0100
commit4dbef3fcd7a14437d55c555cf10d50de8e50d7d1 (patch)
tree632589ecfcfb4dfddeafb71d0077257584b5e7ec /code/app/src/configuration/index.ts
parent914c75e0ceeb3e11ddd55e94bb461c26b0db5b7a (diff)
downloadgreatoffice-4dbef3fcd7a14437d55c555cf10d50de8e50d7d1.tar.xz
greatoffice-4dbef3fcd7a14437d55c555cf10d50de8e50d7d1.zip
feat: Move everything out of $lib
Diffstat (limited to 'code/app/src/configuration/index.ts')
-rw-r--r--code/app/src/configuration/index.ts60
1 files changed, 60 insertions, 0 deletions
diff --git a/code/app/src/configuration/index.ts b/code/app/src/configuration/index.ts
new file mode 100644
index 0000000..9b03b66
--- /dev/null
+++ b/code/app/src/configuration/index.ts
@@ -0,0 +1,60 @@
+export const BASE_DOMAIN = "dev.greatoffice.life";
+export const DEV_BASE_DOMAIN = "http://localhost";
+export const API_ADDRESS = "https://api." + BASE_DOMAIN;
+export const DEV_API_ADDRESS = "http://localhost:5000";
+
+export function api_base(path: string = "", explicitVersion = 1): string {
+ if (path && !path.startsWith("_")) path = "v" + explicitVersion + path;
+ 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