Includes all Phase 1 features: - Search-first navigation with auto-complete - Responsive reading interface (desktop/tablet/mobile) - 4 customization presets + full fine-tuning controls - Layered details panel with notes, bookmarks, highlights - Smart offline caching with IndexedDB and auto-sync - Full accessibility (WCAG 2.1 AA) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
39 lines
825 B
TypeScript
39 lines
825 B
TypeScript
import { getPayloadHMR } from '@payloadcms/next/utilities';
|
|
import config from '@/payload.config';
|
|
|
|
let cachedPayload: any = null;
|
|
|
|
async function getPayload() {
|
|
if (!cachedPayload) {
|
|
cachedPayload = await getPayloadHMR({ config });
|
|
}
|
|
return cachedPayload;
|
|
}
|
|
|
|
async function payloadHandler(req: Request) {
|
|
const payload = await getPayload();
|
|
return payload.handleRequest({
|
|
req,
|
|
});
|
|
}
|
|
|
|
export async function GET(request: Request) {
|
|
return payloadHandler(request);
|
|
}
|
|
|
|
export async function POST(request: Request) {
|
|
return payloadHandler(request);
|
|
}
|
|
|
|
export async function PUT(request: Request) {
|
|
return payloadHandler(request);
|
|
}
|
|
|
|
export async function DELETE(request: Request) {
|
|
return payloadHandler(request);
|
|
}
|
|
|
|
export async function PATCH(request: Request) {
|
|
return payloadHandler(request);
|
|
}
|