From c3e834a2b4d99d7827a07288e8c59189a448a7eb Mon Sep 17 00:00:00 2001 From: Admin Date: Mon, 20 Jul 2026 20:00:41 +0000 Subject: [PATCH] fix: remove duplicate endpoints.ts, fix Login imports - Remove web/src/api/endpoints.ts (redundant with index.ts) - Fix Login.tsx to use useLogin hook - Simplify Dockerfile (use CI-built artifacts) --- Dockerfile | 26 ++-------------- web/src/api/endpoints.ts | 64 ---------------------------------------- web/src/pages/Login.tsx | 17 +++++------ 3 files changed, 10 insertions(+), 97 deletions(-) delete mode 100644 web/src/api/endpoints.ts diff --git a/Dockerfile b/Dockerfile index f07212c..f191ea6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,8 @@ -# Build stage -FROM node:22-alpine AS builder - -WORKDIR /app - -# Install pnpm -RUN corepack enable && corepack prepare pnpm@9 --activate - -# Copy package files -COPY web/package.json web/pnpm-lock.yaml ./ - -# Install dependencies -RUN pnpm install --frozen-lockfile - -# Copy source -COPY web/ ./ - -# Build -RUN pnpm build - -# Production stage +# Production stage - only needs nginx and built files FROM nginx:alpine -# Copy built files -COPY --from=builder /app/dist /usr/share/nginx/html +# Copy built files (from CI artifact or local build) +COPY web/dist /usr/share/nginx/html # Copy nginx config COPY nginx.conf /etc/nginx/conf.d/default.conf diff --git a/web/src/api/endpoints.ts b/web/src/api/endpoints.ts deleted file mode 100644 index 74dd868..0000000 --- a/web/src/api/endpoints.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { request } from './index' -import type { MonitorStats, Task, Script, EnvVar, LogEntry, InterconnectNode, User, Settings } from './types' - -// Auth -export const login = (username: string, password: string) => - request<{ token: string }>('/auth/login', { - method: 'POST', - body: JSON.stringify({ username, password }) - }) - -export const logout = () => request('/auth/logout', { method: 'POST' }) -export const getCurrentUser = () => request('/auth/me') - -// Dashboard -export const getStats = () => request('/stats') -export const getSentence = () => request<{ content: string; author: string }>('/sentence') -export const getTaskStats = () => request<{ total: number; running: number; scheduled: number }>('/taskstats') - -// Tasks -export const getTasks = (params?: { status?: string; tag?: string }) => { - const query = new URLSearchParams(params as any).toString() - return request(`/tasks${query ? '?' + query : ''}`) -} - -export const getTask = (id: number) => request(`/tasks/${id}`) -export const createTask = (data: Partial) => request('/tasks', { method: 'POST', body: JSON.stringify(data) }) -export const updateTask = (id: number, data: Partial) => request(`/tasks/${id}`, { method: 'PUT', body: JSON.stringify(data) }) -export const deleteTask = (id: number) => request(`/tasks/${id}`, { method: 'DELETE' }) -export const executeTask = (id: number) => request(`/execute/task/${id}`, { method: 'POST' }) -export const getTags = () => request('/tasks/tags') - -// Scripts -export const getScripts = () => request('/scripts') -export const getScript = (id: number) => request