* add doctor jobs view * change translation * another translation change * clean up * add analaysis detail view to paths config * translation * merge fix * fix path * move components to shared * refactor * imports * clean up
23 lines
766 B
TypeScript
23 lines
766 B
TypeScript
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<ReturnType<typeof loadUserAnalysis>>;
|
|
|
|
/**
|
|
* @name loadUserAnalysis
|
|
* @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 loadUserAnalysis = cache(analysisLoader);
|
|
|
|
async function analysisLoader(): Promise<UserAnalysis | null> {
|
|
const client = getSupabaseServerClient();
|
|
const api = createAccountsApi(client);
|
|
|
|
return api.getUserAnalysis();
|
|
}
|