B2B-31: refactor profile menu, header
This commit is contained in:
@@ -28,12 +28,8 @@ export const loadTeamWorkspace = cache(workspaceLoader);
|
||||
async function workspaceLoader(accountSlug: string) {
|
||||
const client = getSupabaseServerClient();
|
||||
const api = createTeamAccountsApi(client);
|
||||
|
||||
const [workspace, user] = await Promise.all([
|
||||
api.getAccountWorkspace(accountSlug),
|
||||
requireUserInServerComponent(),
|
||||
]);
|
||||
|
||||
const user = await requireUserInServerComponent();
|
||||
const workspace = await api.getAccountWorkspace(accountSlug, user.id);
|
||||
// we cannot find any record for the selected account
|
||||
// so we redirect the user to the home page
|
||||
if (!workspace.data?.account) {
|
||||
@@ -42,6 +38,7 @@ async function workspaceLoader(accountSlug: string) {
|
||||
|
||||
return {
|
||||
...workspace.data,
|
||||
accounts: workspace.data.accounts.map(({ user_accounts }) => ({...user_accounts})),
|
||||
user,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user