cornpopguy
cornpopguy7mo ago

How to disable Next.js draftmode in tRPC?

Hi guys, is it possible to disable the Next.js draft mode using tRPC? I am tryin to achieve something such as this:
import { draftMode } from 'next/headers';
import { NextRequest, NextResponse } from 'next/server';

export function GET(request: NextRequest) {
draftMode().disable();
const url = new URL(request.nextUrl);
return NextResponse.redirect(new URL('/', url.origin));
}
import { draftMode } from 'next/headers';
import { NextRequest, NextResponse } from 'next/server';

export function GET(request: NextRequest) {
draftMode().disable();
const url = new URL(request.nextUrl);
return NextResponse.redirect(new URL('/', url.origin));
}
But with tRPC, I tried calling draftMode().disable(); in my tRPC function but nothing happened, draftMode did not get disabled.
0 Replies
No replies yetBe the first to reply to this messageJoin