B2B-87: add company statistics consent (#29)
* B2B-87: add company statistics consent * add toggle for company statistics consent under profile * add toggle for company statistics consent under profile * add audit logging to accounts * change policy * add audit logging to accounts * remove full account data query and just query the entire account every time * add comment about consent toggle * make constants hardcoded, as dynamic ones do not work * add back pending check --------- Co-authored-by: Helena <helena@Helenas-MacBook-Pro.local>
This commit is contained in:
21
app/home/(user)/_lib/server/load-user-account.ts
Normal file
21
app/home/(user)/_lib/server/load-user-account.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { cache } from 'react';
|
||||
|
||||
import { createAccountsApi } from '@kit/accounts/api';
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
|
||||
export type UserAccount = Awaited<ReturnType<typeof loadUserAccount>>;
|
||||
|
||||
/**
|
||||
* @name loadUserAccount
|
||||
* @description
|
||||
* Load the user account. 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 loadUserAccount = cache(accountLoader);
|
||||
|
||||
async function accountLoader(accountId: string) {
|
||||
const client = getSupabaseServerClient();
|
||||
const api = createAccountsApi(client);
|
||||
|
||||
return api.getAccount(accountId);
|
||||
}
|
||||
Reference in New Issue
Block a user