An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
import { getAuthProvider } from '@/lib/auth/provider'
import { perfLog } from '@/lib/utils/perf-logging'
import { incrementAuthCallCount } from '@/lib/utils/perf-tracking'
import type { AppUser } from './types'
export async function getCurrentUser(): Promise<AppUser | null> {
return getAuthProvider().getCurrentUser()
}
export async function getCurrentUserId() {
const count = incrementAuthCallCount()
perfLog(`getCurrentUserId called - count: ${count}`)
const provider = getAuthProvider()
if (provider.getCurrentUserId) {
return provider.getCurrentUserId()
}
const user = await provider.getCurrentUser()
return user?.id
}