mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
## Description Currently the language cookie is set to session, so restarting browser will reset it. This sets the expiry for two years. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced language preference functionality with extended cookie lifespan for improved user experience. - **Bug Fixes** - Resolved issues related to cookie expiration for language settings. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
12 lines
291 B
TypeScript
12 lines
291 B
TypeScript
'use server';
|
|
|
|
import { cookies } from 'next/headers';
|
|
|
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
export const switchI18NLanguage = async (lang: string) => {
|
|
// Two year expiry.
|
|
const maxAge = 60 * 60 * 24 * 365 * 2;
|
|
|
|
cookies().set('language', lang, { maxAge });
|
|
};
|