fix: hide blocked user content
This commit is contained in:
@@ -15,14 +15,26 @@ const BFF_BASE = process.env.BFF_URL || "http://localhost:8080";
|
||||
type EmptyShape = {
|
||||
query: string;
|
||||
results: Array<{ handle: string; name: string; avatar_url: string | null }>;
|
||||
total: number;
|
||||
page: number;
|
||||
limit: number;
|
||||
total_pages: number;
|
||||
};
|
||||
|
||||
const empty = (q: string): EmptyShape => ({ query: q, results: [] });
|
||||
const empty = (q: string): EmptyShape => ({
|
||||
query: q,
|
||||
results: [],
|
||||
total: 0,
|
||||
page: 1,
|
||||
limit: 20,
|
||||
total_pages: 0,
|
||||
});
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const { searchParams } = request.nextUrl;
|
||||
const q = (searchParams.get("q") || "").trim();
|
||||
const limit = searchParams.get("limit") || "20";
|
||||
const page = searchParams.get("page") || "1";
|
||||
|
||||
if (!q) {
|
||||
return NextResponse.json(empty(""));
|
||||
@@ -32,6 +44,7 @@ export async function GET(request: NextRequest) {
|
||||
const url = new URL("/api/v1/users/search", BFF_BASE);
|
||||
url.searchParams.set("q", q);
|
||||
url.searchParams.set("limit", limit);
|
||||
url.searchParams.set("page", page);
|
||||
|
||||
const res = await fetch(url.toString(), {
|
||||
headers: { Accept: "application/json" },
|
||||
|
||||
Reference in New Issue
Block a user