|
|
@@ -21,7 +21,6 @@ export const useAuthStore = defineStore("auth", () => {
|
|
|
);
|
|
|
} catch {
|
|
|
user.value = null;
|
|
|
- wsAuthFailed.value = true;
|
|
|
showCompleteProfile.value = false;
|
|
|
stopPing();
|
|
|
} finally {
|
|
|
@@ -35,7 +34,6 @@ export const useAuthStore = defineStore("auth", () => {
|
|
|
|
|
|
let globalWs: WebSocket | null = null;
|
|
|
let reconnectTimer: number | null = null;
|
|
|
- const WS_BASE_URL = getWsUrl();
|
|
|
|
|
|
// ── Audio ──────────────────────────────────────────────────────────────────
|
|
|
// Single shared AudioContext, created lazily on first user gesture.
|
|
|
@@ -141,7 +139,9 @@ export const useAuthStore = defineStore("auth", () => {
|
|
|
stopPing(); // Ensure fresh start
|
|
|
const token = localStorage.getItem("token");
|
|
|
if (!token || wsAuthFailed.value) return;
|
|
|
- globalWs = new WebSocket(`${WS_BASE_URL}/global?token=${encodeURIComponent(token)}`);
|
|
|
+ const url = `${getWsUrl()}/global?token=${encodeURIComponent(token)}`;
|
|
|
+ console.log("DEBUG: Connecting Global WS to:", url);
|
|
|
+ globalWs = new WebSocket(url);
|
|
|
|
|
|
globalWs.onopen = () => {
|
|
|
// Send ping every 25 seconds to keep connection alive and update online status in Redis
|