import { cache } from 'react'; import { createAccountsApi } from '@kit/accounts/api'; import { UserAnalysis } from '@kit/accounts/types/accounts'; import { getSupabaseServerClient } from '@kit/supabase/server-client'; export type UserAnalyses = Awaited>; /** * @name loadUserAnalyses * @description * Load the user's analyses. It's a cached per-request function that fetches the user workspace data. * It can be used across the server components to load the user workspace data. */ export const loadUserAnalyses = cache(analysesLoader); async function analysesLoader(): Promise { const client = getSupabaseServerClient(); const api = createAccountsApi(client); return api.getUserAnalyses(); }