feat(ST-903): load active product in layout, replace cookie with DB lookup in solo

- layout.tsx: fetch active_product_id, resolve product, clear stale ref server-side
- NavBar: add activeProduct prop (rendering changes in ST-904)
- solo/page.tsx: redirect via user.active_product_id instead of lastProductId cookie
- proxy.ts: remove lastProductId cookie logic
- lib/cookies.ts: deleted (no longer used)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Janpeter Visser 2026-04-27 19:04:02 +02:00
parent 35d60cc43b
commit 12d81a172f
5 changed files with 34 additions and 44 deletions

View file

@ -1,19 +0,0 @@
import { cookies } from 'next/headers'
const LAST_PRODUCT_COOKIE = 'lastProductId'
const THIRTY_DAYS_SECONDS = 60 * 60 * 24 * 30
export async function setLastProductCookie(productId: string) {
const store = await cookies()
store.set(LAST_PRODUCT_COOKIE, productId, {
httpOnly: true,
sameSite: 'lax',
maxAge: THIRTY_DAYS_SECONDS,
path: '/',
})
}
export async function getLastProductCookie(): Promise<string | null> {
const store = await cookies()
return store.get(LAST_PRODUCT_COOKIE)?.value ?? null
}