refactor: clean up imports and enhance error logging in user workspace and team invitations actions

This commit is contained in:
Danel Kungla
2025-07-08 18:34:21 +03:00
parent 29ff8cb512
commit 4f36f9c037
5 changed files with 41 additions and 33 deletions

View File

@@ -56,6 +56,7 @@ class AccountsApi {
const { data, error: userError } = authUser;
if (userError) {
console.error('Failed to get user', userError);
throw userError;
}
@@ -65,25 +66,26 @@ class AccountsApi {
.from('accounts_memberships')
.select(
`
account_id,
user_accounts (
name,
slug,
picture_url,
)
`,
account_id,
accounts (
name,
slug,
picture_url
)
`,
)
.eq('user_id', user.id)
.eq('account_role', 'owner');
if (error) {
console.error('error', error);
throw error;
}
return accounts.map(({ user_accounts }) => ({
label: user_accounts.name,
value: user_accounts.slug,
image: user_accounts.picture_url,
return accounts.map(({ accounts }) => ({
label: accounts.name,
value: accounts.slug,
image: accounts.picture_url,
}));
}