UNPKG

@devcycle/nextjs-sdk

Version:

The Next.js SDK for DevCycle!

20 lines 673 B
'use server'; import { cookies } from 'next/headers'; import { revalidateTag } from 'next/cache'; import { debugUserCookieName } from '../cookie'; export const setDebugUser = async (user) => { if (!user.user_id) { console.warn('Debug user not set: user_id is required'); return; } const cookieStore = await cookies(); cookieStore.set(debugUserCookieName, JSON.stringify(user), { httpOnly: true, secure: process.env.NODE_ENV === 'production', sameSite: 'strict', path: '/', }); // Revalidate caches to trigger fresh bucketing revalidateTag(user.user_id); }; //# sourceMappingURL=setDebugUser.js.map