feat(MED-161): move analyses logic to separate package from kit/accounts
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
import { toTitleCase } from '@/lib/utils';
|
||||
import { createAccountsApi } from '@/packages/features/accounts/src/server/api';
|
||||
import { createUserAnalysesApi } from '@kit/user-analyses/api';
|
||||
import { getSupabaseServerClient } from '@/packages/supabase/src/clients/server-client';
|
||||
|
||||
import { PageBody, PageHeader } from '@kit/ui/page';
|
||||
@@ -27,7 +27,7 @@ async function UserHomePage() {
|
||||
const client = getSupabaseServerClient();
|
||||
|
||||
const { account } = await loadCurrentUserAccount();
|
||||
const api = createAccountsApi(client);
|
||||
const api = createUserAnalysesApi(client);
|
||||
const bmiThresholds = await api.fetchBmiThresholds();
|
||||
|
||||
if (!account) {
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
import { use } from 'react';
|
||||
|
||||
import { createAccountsApi } from '@/packages/features/accounts/src/server/api';
|
||||
import { CompanyGuard } from '@/packages/features/team-accounts/src/components';
|
||||
import { createTeamAccountsApi } from '@/packages/features/team-accounts/src/server/api';
|
||||
import { getSupabaseServerClient } from '@/packages/supabase/src/clients/server-client';
|
||||
import { createUserAnalysesApi } from '@kit/user-analyses/api';
|
||||
|
||||
import { PageBody } from '@kit/ui/page';
|
||||
|
||||
@@ -35,10 +35,10 @@ function TeamAccountHomePage({ params }: TeamAccountHomePageProps) {
|
||||
const account = use(params).account;
|
||||
const client = getSupabaseServerClient();
|
||||
const teamAccountsApi = createTeamAccountsApi(client);
|
||||
const accountsApi = createAccountsApi(client);
|
||||
const userAnalysesApi = createUserAnalysesApi(client);
|
||||
const teamAccount = use(teamAccountsApi.getTeamAccount(account));
|
||||
const { memberParams, members } = use(teamAccountsApi.getMembers(account));
|
||||
const bmiThresholds = use(accountsApi.fetchBmiThresholds());
|
||||
const bmiThresholds = use(userAnalysesApi.fetchBmiThresholds());
|
||||
const companyParams = use(
|
||||
teamAccountsApi.getTeamAccountParams(teamAccount.id),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user