Fix authentication state persistence and admin role display
- Implement complete authentication system with JWT token validation - Add auth provider with persistent login state across page refreshes - Create multilingual login/register forms with Material-UI components - Fix token validation using raw SQL queries to bypass Prisma sync issues - Add comprehensive error handling for expired/invalid tokens - Create profile and settings pages with full i18n support - Add proper user role management (admin/user) with database sync - Implement secure middleware with CSRF protection and auth checks - Add debug endpoints for troubleshooting authentication issues - Fix Zustand store persistence for authentication state 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -36,7 +36,20 @@ async function resolveVectorTable(language: string): Promise<{ table: string; ex
|
||||
) AS exists`,
|
||||
[VECTOR_SCHEMA, `bv_${lang}_${ab}`]
|
||||
)
|
||||
return { table, exists: Boolean(check.rows?.[0]?.exists) }
|
||||
let exists = Boolean(check.rows?.[0]?.exists)
|
||||
if (!exists) {
|
||||
// Fallback: use any table for this language
|
||||
const anyTbl = await client.query(
|
||||
`SELECT table_name FROM information_schema.tables
|
||||
WHERE table_schema = $1 AND table_name LIKE $2
|
||||
ORDER BY table_name LIMIT 1`,
|
||||
[VECTOR_SCHEMA, `bv_${lang}_%`]
|
||||
)
|
||||
if (anyTbl.rows?.[0]?.table_name) {
|
||||
return { table: `${VECTOR_SCHEMA}."${anyTbl.rows[0].table_name}"`, exists: true }
|
||||
}
|
||||
}
|
||||
return { table, exists }
|
||||
} finally {
|
||||
client.release()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user