Skip to content

Commit cb60f12

Browse files
committed
refactor(nextjs): filter tasks
1 parent 33dc3e8 commit cb60f12

16 files changed

Lines changed: 394 additions & 1391 deletions

File tree

apps/nextjs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"phoenix": "^1.8.1",
3434
"react": "19.2.0",
3535
"react-dom": "19.2.0",
36+
"swr": "^2.4.1",
3637
"tailwind-merge": "^3.3.1",
3738
"uplot": "^1.6.32",
3839
"y-excalidraw": "^2.0.12"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { NextRequest, NextResponse } from "next/server";
2+
import { fetchTodos } from "~/features/todos/query";
3+
4+
export async function GET(request: NextRequest) {
5+
const boardId = request.nextUrl.searchParams.get("boardId");
6+
7+
if (!boardId) {
8+
return NextResponse.json(
9+
{ message: "boardId query parameter is required" },
10+
{ status: 400 },
11+
);
12+
}
13+
14+
try {
15+
const filter = request.nextUrl.searchParams.get("filter");
16+
const result = await fetchTodos(
17+
boardId,
18+
filter
19+
? {
20+
filter: {
21+
title: { contains: filter },
22+
},
23+
}
24+
: {},
25+
);
26+
27+
return NextResponse.json(result);
28+
} catch (error) {
29+
console.error("Failed to load todos route data:", error);
30+
31+
return NextResponse.json(
32+
{ message: "Failed to load todos" },
33+
{ status: 500 },
34+
);
35+
}
36+
}

apps/nextjs/src/app/todos/[boardId]/_components/control-panel.tsx

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)