Build the Salar Store storefront and connect products, blogs, and home specials to the Meshkee API.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
2783305f07
commit
7d26eaa838
@@ -0,0 +1,12 @@
|
||||
import { API } from "@/lib/site";
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const body = await request.json();
|
||||
const response = await fetch(`${API.base}/tenants/${API.domain}/comments`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
const data = await response.json();
|
||||
return Response.json(data, { status: response.status });
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { listMappedProducts } from "@/lib/mappers";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const query = new URL(request.url).searchParams.get("q")?.trim() ?? "";
|
||||
if (query.length < 2) {
|
||||
return Response.json({ items: [] });
|
||||
}
|
||||
|
||||
const data = await listMappedProducts({ name: query, page: 1, pageSize: 8 });
|
||||
return Response.json({ items: data.items, total: data.total });
|
||||
}
|
||||
Reference in New Issue
Block a user