adding cookie storage for current organization.

This commit is contained in:
killian-larcher
2024-12-15 21:26:28 +01:00
parent f4fa966d89
commit 5484e8841a
3 changed files with 55 additions and 19 deletions
+14
View File
@@ -0,0 +1,14 @@
'use server';
import {cookies} from 'next/headers';
const COOKIE_NAME = 'PORTABASE_ORGANIZATION_SLUG';
export async function getCurrentOrganizationSlug() {
return (await cookies()).get(COOKIE_NAME)?.value || "default";
}
export async function setCurrentOrganizationSlug(slug: string) {
return (await cookies()).set(COOKIE_NAME, slug).get(COOKIE_NAME)?.value;
}