B2B-31: refactor profile menu, header

This commit is contained in:
devmc-ee
2025-06-29 19:25:50 +03:00
parent a8dbc98b62
commit fbbc2f8760
14 changed files with 132 additions and 69 deletions

View File

@@ -90,18 +90,31 @@ export class TeamAccountsApi {
* @description Get the account workspace data.
* @param slug
*/
async getAccountWorkspace(slug: string) {
async getAccountWorkspace(slug: string, userId: string) {
const accountPromise = this.client.rpc('team_account_workspace', {
account_slug: slug,
});
const accountsPromise = this.client.from('user_accounts').select('*');
const accountsPromise = this.client
.from('accounts_memberships')
.select(`
account_id,
user_accounts (
id,
role,
name,
slug,
picture_url
)
`)
.eq('user_id', userId)
.eq('account_role', 'owner');
const [accountResult, accountsResult] = await Promise.all([
accountPromise,
accountsPromise,
]);
if (accountResult.error) {
return {
error: accountResult.error,