refactor: Centralize platform mode detection using IS_PLATFORM constant; use token from Auth context in WebSocket connection

This commit is contained in:
Haileyesus
2026-01-31 14:34:01 +03:00
parent 471892b2bd
commit cfd766819a
8 changed files with 25 additions and 16 deletions

View File

@@ -1,5 +1,6 @@
import React, { createContext, useContext, useEffect, useState } from 'react';
import { api } from '../utils/api';
import { IS_PLATFORM } from '../../shared/modelConstants';
const AuthContext = createContext({
user: null,
@@ -31,7 +32,7 @@ export const AuthProvider = ({ children }) => {
const [error, setError] = useState(null);
useEffect(() => {
if (import.meta.env.VITE_IS_PLATFORM === 'true') {
if (IS_PLATFORM) {
setUser({ username: 'platform-user' });
setNeedsSetup(false);
checkOnboardingStatus();