refactor: Remove /ui path prefix
Removed the /ui basePath from Next.js configuration to serve the app at root path: - Removed basePath: "/ui" from next.config.ts - Updated all API route calls from /ui/api/* to /api/* - App now accessible at root path instead of /ui subdirectory 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -53,7 +53,7 @@ export default function JobsPage() {
|
||||
const { data: projects, isLoading: isProjectsLoading } = useQuery({
|
||||
queryKey: ["projects"],
|
||||
queryFn: async (): Promise<ListProjects> => {
|
||||
const res = await fetch("/ui/api/scrapyd/projects");
|
||||
const res = await fetch("/api/scrapyd/projects");
|
||||
if (!res.ok) throw new Error("Failed to fetch projects");
|
||||
return res.json();
|
||||
},
|
||||
@@ -63,7 +63,7 @@ export default function JobsPage() {
|
||||
const { data: jobs, isLoading: isJobsLoading } = useQuery({
|
||||
queryKey: ["jobs", selectedProject],
|
||||
queryFn: async (): Promise<ListJobs> => {
|
||||
const res = await fetch(`/ui/api/scrapyd/jobs?project=${selectedProject}`);
|
||||
const res = await fetch(`/api/scrapyd/jobs?project=${selectedProject}`);
|
||||
if (!res.ok) throw new Error("Failed to fetch jobs");
|
||||
return res.json();
|
||||
},
|
||||
@@ -74,7 +74,7 @@ export default function JobsPage() {
|
||||
// Cancel job mutation
|
||||
const cancelJobMutation = useMutation({
|
||||
mutationFn: async (data: { project: string; job: string }) => {
|
||||
const res = await fetch("/ui/api/scrapyd/jobs", {
|
||||
const res = await fetch("/api/scrapyd/jobs", {
|
||||
method: "DELETE",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(data),
|
||||
|
||||
@@ -18,7 +18,7 @@ export default function DashboardPage() {
|
||||
const { data: daemonStatus, isLoading: isDaemonLoading } = useQuery({
|
||||
queryKey: ["daemon-status"],
|
||||
queryFn: async (): Promise<DaemonStatus> => {
|
||||
const res = await fetch("/ui/api/scrapyd/daemon");
|
||||
const res = await fetch("/api/scrapyd/daemon");
|
||||
if (!res.ok) throw new Error("Failed to fetch daemon status");
|
||||
return res.json();
|
||||
},
|
||||
@@ -27,7 +27,7 @@ export default function DashboardPage() {
|
||||
const { data: projects, isLoading: isProjectsLoading } = useQuery({
|
||||
queryKey: ["projects"],
|
||||
queryFn: async () => {
|
||||
const res = await fetch("/ui/api/scrapyd/projects");
|
||||
const res = await fetch("/api/scrapyd/projects");
|
||||
if (!res.ok) throw new Error("Failed to fetch projects");
|
||||
return res.json();
|
||||
},
|
||||
|
||||
@@ -45,7 +45,7 @@ export default function ProjectsPage() {
|
||||
const { data: projects, isLoading: isProjectsLoading } = useQuery({
|
||||
queryKey: ["projects"],
|
||||
queryFn: async (): Promise<ListProjects> => {
|
||||
const res = await fetch("/ui/api/scrapyd/projects");
|
||||
const res = await fetch("/api/scrapyd/projects");
|
||||
if (!res.ok) throw new Error("Failed to fetch projects");
|
||||
return res.json();
|
||||
},
|
||||
@@ -56,7 +56,7 @@ export default function ProjectsPage() {
|
||||
queryKey: ["versions", selectedProject],
|
||||
queryFn: async (): Promise<ListVersions> => {
|
||||
const res = await fetch(
|
||||
`/ui/api/scrapyd/versions?project=${selectedProject}`
|
||||
`/api/scrapyd/versions?project=${selectedProject}`
|
||||
);
|
||||
if (!res.ok) throw new Error("Failed to fetch versions");
|
||||
return res.json();
|
||||
@@ -67,7 +67,7 @@ export default function ProjectsPage() {
|
||||
// Delete project mutation
|
||||
const deleteProjectMutation = useMutation({
|
||||
mutationFn: async (project: string) => {
|
||||
const res = await fetch("/ui/api/scrapyd/projects", {
|
||||
const res = await fetch("/api/scrapyd/projects", {
|
||||
method: "DELETE",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ project }),
|
||||
@@ -85,7 +85,7 @@ export default function ProjectsPage() {
|
||||
// Upload version mutation
|
||||
const uploadVersionMutation = useMutation({
|
||||
mutationFn: async (formData: FormData) => {
|
||||
const res = await fetch("/ui/api/scrapyd/versions", {
|
||||
const res = await fetch("/api/scrapyd/versions", {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
});
|
||||
|
||||
@@ -47,7 +47,7 @@ export default function SpidersPage() {
|
||||
const { data: projects, isLoading: isProjectsLoading } = useQuery({
|
||||
queryKey: ["projects"],
|
||||
queryFn: async (): Promise<ListProjects> => {
|
||||
const res = await fetch("/ui/api/scrapyd/projects");
|
||||
const res = await fetch("/api/scrapyd/projects");
|
||||
if (!res.ok) throw new Error("Failed to fetch projects");
|
||||
return res.json();
|
||||
},
|
||||
@@ -58,7 +58,7 @@ export default function SpidersPage() {
|
||||
queryKey: ["spiders", selectedProject],
|
||||
queryFn: async (): Promise<ListSpiders> => {
|
||||
const res = await fetch(
|
||||
`/ui/api/scrapyd/spiders?project=${selectedProject}`
|
||||
`/api/scrapyd/spiders?project=${selectedProject}`
|
||||
);
|
||||
if (!res.ok) throw new Error("Failed to fetch spiders");
|
||||
return res.json();
|
||||
@@ -73,7 +73,7 @@ export default function SpidersPage() {
|
||||
spider: string;
|
||||
args?: Record<string, string>;
|
||||
}) => {
|
||||
const res = await fetch("/ui/api/scrapyd/jobs", {
|
||||
const res = await fetch("/api/scrapyd/jobs", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(data),
|
||||
|
||||
@@ -21,7 +21,7 @@ export default function SystemPage() {
|
||||
const { data: daemonStatus, isLoading: isDaemonLoading } = useQuery({
|
||||
queryKey: ["daemon-status"],
|
||||
queryFn: async (): Promise<DaemonStatus> => {
|
||||
const res = await fetch("/ui/api/scrapyd/daemon");
|
||||
const res = await fetch("/api/scrapyd/daemon");
|
||||
if (!res.ok) throw new Error("Failed to fetch daemon status");
|
||||
return res.json();
|
||||
},
|
||||
@@ -31,7 +31,7 @@ export default function SystemPage() {
|
||||
const { data: projects, isLoading: isProjectsLoading } = useQuery({
|
||||
queryKey: ["projects"],
|
||||
queryFn: async (): Promise<ListProjects> => {
|
||||
const res = await fetch("/ui/api/scrapyd/projects");
|
||||
const res = await fetch("/api/scrapyd/projects");
|
||||
if (!res.ok) throw new Error("Failed to fetch projects");
|
||||
return res.json();
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@ import { cn } from "@/lib/utils";
|
||||
import {
|
||||
LayoutDashboard,
|
||||
FolderKanban,
|
||||
Bug,
|
||||
Webhook,
|
||||
BriefcaseBusiness,
|
||||
Activity,
|
||||
Menu,
|
||||
@@ -35,7 +35,7 @@ const routes = [
|
||||
},
|
||||
{
|
||||
label: "Spiders",
|
||||
icon: Bug,
|
||||
icon: Webhook,
|
||||
href: "/spiders",
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
basePath: "/ui",
|
||||
output: "standalone",
|
||||
experimental: {
|
||||
optimizePackageImports: ["lucide-react"],
|
||||
|
||||
Reference in New Issue
Block a user