Update user authentication and refactor UI components
Refactored the user authentication method in the dashboard from getSession to getUser, and updated its related variables accordingly. UI components have also been modified, which includes streamlining the importation of the 'cn' function and exporting the 'Stepper' function directly. Lastly, the 'Stepper' function is now included in the package.json for the UI component package.
This commit is contained in:
@@ -16,7 +16,7 @@ import { loadUserWorkspace } from '../_lib/load-user-workspace';
|
||||
|
||||
export function HomeSidebar() {
|
||||
const collapsed = getSidebarCollapsed();
|
||||
const { accounts, session } = use(loadUserWorkspace());
|
||||
const { accounts, user } = use(loadUserWorkspace());
|
||||
|
||||
return (
|
||||
<Sidebar collapsed={collapsed}>
|
||||
@@ -38,10 +38,7 @@ export function HomeSidebar() {
|
||||
|
||||
<div className={'absolute bottom-4 left-0 w-full'}>
|
||||
<SidebarContent>
|
||||
<ProfileAccountDropdownContainer
|
||||
collapsed={collapsed}
|
||||
user={session?.user ?? null}
|
||||
/>
|
||||
<ProfileAccountDropdownContainer collapsed={collapsed} user={user} />
|
||||
</SidebarContent>
|
||||
</div>
|
||||
</Sidebar>
|
||||
|
||||
@@ -10,11 +10,11 @@ export const loadUserWorkspace = cache(async () => {
|
||||
const loadAccounts = featureFlagsConfig.enableTeamAccounts;
|
||||
|
||||
const accounts = loadAccounts ? await loadUserAccounts(client) : [];
|
||||
const { data } = await client.auth.getSession();
|
||||
const { data } = await client.auth.getUser();
|
||||
|
||||
return {
|
||||
accounts,
|
||||
session: data.session,
|
||||
user: data.user,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user