feat: team org panel, admin CRUD, local deploy tools, bidirectional data sync
Add TeamMember model and APIs, team status UI, /admin page, local server bats, and scripts to sync data between local PostgreSQL and Render. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,24 +1,17 @@
|
||||
import { createContext, useContext, useEffect, useRef, type ReactNode } from 'react';
|
||||
import { io, type Socket } from 'socket.io-client';
|
||||
import { getSocketUrl } from '../lib/apiBase';
|
||||
|
||||
const SocketContext = createContext<Socket | null>(null);
|
||||
|
||||
const RENDER_API = 'https://eene-dashboard-backend.onrender.com';
|
||||
|
||||
const SOCKET_URL =
|
||||
import.meta.env.VITE_SOCKET_URL ||
|
||||
(import.meta.env.PROD
|
||||
? RENDER_API
|
||||
: `${window.location.protocol}//${window.location.hostname}:4000`);
|
||||
|
||||
export function SocketProvider({ children }: { children: ReactNode }) {
|
||||
const socketRef = useRef<Socket | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const socket = io(SOCKET_URL, { transports: ['websocket'] });
|
||||
const socket = io(getSocketUrl(), { transports: ['websocket'] });
|
||||
socketRef.current = socket;
|
||||
|
||||
socket.on('connect', () => console.log('[Socket] Connected'));
|
||||
socket.on('connect', () => console.log('[Socket] Connected', getSocketUrl()));
|
||||
socket.on('disconnect', () => console.log('[Socket] Disconnected'));
|
||||
|
||||
return () => {
|
||||
|
||||
Reference in New Issue
Block a user