()
| 5 | const COOKIE_NAME = "notfair_active_project"; |
| 6 | |
| 7 | export async function getActiveProject(): Promise<Project | null> { |
| 8 | const c = await cookies(); |
| 9 | const slug = c.get(COOKIE_NAME)?.value; |
| 10 | if (slug) { |
| 11 | const p = getProject(slug); |
| 12 | if (p && !p.archived_at) return p; |
| 13 | } |
| 14 | // Fall back to the first non-archived project, if any. |
| 15 | const all = listProjects(); |
| 16 | return all[0] ?? null; |
| 17 | } |
| 18 | |
| 19 | export async function setActiveProject(slug: string): Promise<void> { |
| 20 | const c = await cookies(); |
no test coverage detected