B2B-31: refactor profile menu, header
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user