20 lines
541 B
TypeScript
20 lines
541 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { listPrintfulStores } from "../../../../lib/printful";
|
|
|
|
export async function GET() {
|
|
try {
|
|
const stores = await listPrintfulStores();
|
|
const normalized = (stores || []).map((store: any) => ({
|
|
id: store.id,
|
|
name: store.name,
|
|
type: store.type,
|
|
}));
|
|
return NextResponse.json({ stores: normalized });
|
|
} catch (err: any) {
|
|
return NextResponse.json(
|
|
{ error: err?.message || "Failed to load Printful stores." },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|