feat: enhance opportunity detail and sales flow

This commit is contained in:
2026-03-03 19:46:12 -06:00
parent 9145ea5ba4
commit c628a78b27
13 changed files with 1030 additions and 88 deletions
+39
View File
@@ -0,0 +1,39 @@
<script lang="ts">
import { onMount, onDestroy } from "svelte";
import { goto } from "$app/navigation";
const INTERVAL_MS = 60_000; // 60 seconds
let timer: ReturnType<typeof setInterval> | null = null;
async function checkSession() {
try {
const res = await fetch("/api/auth/check", {
credentials: "same-origin",
});
if (!res.ok) {
// Session is dead — redirect to login
console.warn("Session expired or invalid — redirecting to login.");
goto("/login");
}
} catch (err) {
// Network error (API unreachable, etc.) — don't redirect on transient
// failures; the next tick will retry.
console.warn("Session check failed (network error):", err);
}
}
onMount(() => {
// Run the first check immediately, then every 60 s
checkSession();
timer = setInterval(checkSession, INTERVAL_MS);
});
onDestroy(() => {
if (timer) {
clearInterval(timer);
timer = null;
}
});
</script>