- Add slides.tool.ts with support for title, bullets, chart, stats, table, cards, timeline, quote, comparison, equation, image, summary slide types - Chart types: bar, horizontal-bar, line, donut, radar - Integrate with agent executor and canvas system - Add multilingual support (en/fr) - Various UI improvements and bug fixes Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
18 lines
554 B
TypeScript
18 lines
554 B
TypeScript
import { auth } from '@/auth'
|
|
|
|
/**
|
|
* Retrieves the authenticated user ID or throws an Unauthorized error.
|
|
* Use this in Server Actions and API routes to eliminate the repetitive
|
|
* `const session = await auth(); if (!session?.user?.id) ...` boilerplate.
|
|
*
|
|
* @throws {Error} 'Unauthorized' if no valid session exists.
|
|
* @returns The authenticated user's ID string.
|
|
*/
|
|
export async function requireAuth(): Promise<string> {
|
|
const session = await auth()
|
|
if (!session?.user?.id) {
|
|
throw new Error('Unauthorized')
|
|
}
|
|
return session.user.id
|
|
}
|