()
| 21 | * @returns {Promise<{id: string, role: 'admin', ...}>} |
| 22 | */ |
| 23 | export async function requireAdmin() { |
| 24 | const user = await requireAuth(); |
| 25 | if (user.role !== 'admin') throw new Error('Forbidden'); |
| 26 | return user; |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Get the auth state for the main page (server component). |
no test coverage detected