Files
Shifted/app/api/printful/stores/route.ts
2026-02-10 01:14:19 +00:00

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 }
);
}
}