aboutsummaryrefslogtreecommitdiffstats
path: root/code/app/src/lib/session.ts
diff options
context:
space:
mode:
Diffstat (limited to 'code/app/src/lib/session.ts')
-rw-r--r--code/app/src/lib/session.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/code/app/src/lib/session.ts b/code/app/src/lib/session.ts
index ee79933..7cd5fcf 100644
--- a/code/app/src/lib/session.ts
+++ b/code/app/src/lib/session.ts
@@ -1,9 +1,9 @@
-import {logError, logInfo} from "$lib/logger";
+import { log_error, log_info } from "$lib/logger";
import { Temporal } from "temporal-polyfill";
import { get_profile_for_active_check, logout } from "./api/user";
import { is_guid, session_storage_get_json, session_storage_set_json } from "./helpers";
import { SECONDS_BETWEEN_SESSION_CHECK, StorageKeys } from "./configuration";
-import type { ISession } from "$lib/models/ISession";
+import type { ISession } from "$lib/models/internal/ISession";
export async function is_active(forceRefresh: boolean = false): Promise<boolean> {
const nowEpoch = Temporal.Now.instant().epochSeconds;
@@ -16,7 +16,7 @@ export async function is_active(forceRefresh: boolean = false): Promise<boolean>
const sessionIsValid = data.profile && is_guid(data.profile.id);
if (!sessionIsValid) {
clear_session_data();
- logInfo("Session data is not valid");
+ log_info("Session data is not valid");
}
return sessionIsValid;
}
@@ -29,7 +29,7 @@ export async function end_session(cb: Function): Promise<void> {
}
async function call_api(): Promise<boolean> {
- logInfo("Getting profile data while checking session state");
+ log_info("Getting profile data while checking session state");
try {
const response = await get_profile_for_active_check();
if (response.ok) {
@@ -40,20 +40,20 @@ async function call_api(): Promise<boolean> {
lastChecked: Temporal.Now.instant().epochSeconds
} as ISession;
session_storage_set_json(StorageKeys.session, session);
- logInfo("Successfully got profile data while checking session state");
+ log_info("Successfully got profile data while checking session state");
return true;
} else {
- logError("Api returned invalid data while getting profile data");
+ log_error("Api returned invalid data while getting profile data");
clear_session_data();
return false;
}
} else {
- logError("Api returned unsuccessfully while getting profile data");
+ log_error("Api returned unsuccessfully while getting profile data");
clear_session_data();
return false;
}
} catch (e) {
- logError(e);
+ log_error(e);
clear_session_data();
return false;
}
@@ -61,7 +61,7 @@ async function call_api(): Promise<boolean> {
export function clear_session_data() {
session_storage_set_json(StorageKeys.session, {});
- logInfo("Cleared session data.");
+ log_info("Cleared session data.");
}
export function get_session_data(): ISession {