Files
Dominik Ferber db89f0dfb1 Init
2024-12-12 13:01:06 +02:00

23 lines
581 B
TypeScript

import { flag } from '@vercel/flags/next';
export const exampleFlag = flag<boolean>({
key: 'example-flag',
decide: () => true,
defaultValue: false,
options: [false, true],
});
export const hostFlag = flag<string>({
key: 'host',
decide: ({ headers }) => headers.get('host') || 'no host',
options: ['no host', 'localhost'],
});
export const cookieFlag = flag<string>({
key: 'cookie',
decide: ({ cookies }) => cookies.get('example-cookie')?.value || 'no cookie',
options: ['no cookie'],
});
export const precomputedFlags = [exampleFlag, hostFlag, cookieFlag];