chore: bump version to 2.23.10 and enhance workspace loading logic (#447)
* chore: bump version to 2.23.10 and enhance workspace loading logic - Updated application version from 2.23.9 to 2.23.10 in package.json. - Refactored workspace loading functions to use async/await for improved error handling and added redirects for missing workspaces or users. - Updated sidebar layout components to handle asynchronous data fetching and redirection more effectively. - Minor adjustments to personal account dropdown styles for consistency.
This commit is contained in:
committed by
GitHub
parent
2835c163cb
commit
255ba19766
@@ -1,5 +1,7 @@
|
||||
import { cache } from 'react';
|
||||
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
import { createAccountsApi } from '@kit/accounts/api';
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
import { createAccountCreationPolicyEvaluator } from '@kit/team-accounts/policies';
|
||||
@@ -35,6 +37,11 @@ async function workspaceLoader() {
|
||||
requireUserInServerComponent(),
|
||||
]);
|
||||
|
||||
// If the user is not found or the workspace is not found, redirect to the home page - this may happen if the JWT is invalid or expired (ex. user deleted?)
|
||||
if (!workspace || !user) {
|
||||
redirect('/');
|
||||
}
|
||||
|
||||
// Check if user can create team accounts (policy check)
|
||||
const canCreateTeamAccount = shouldLoadAccounts
|
||||
? await checkCanCreateTeamAccount(user.id)
|
||||
|
||||
Reference in New Issue
Block a user