Update Next.js version and improve session handling

Next.js version has been upgraded from 14.2.0-canary.58 to 14.2.0-canary.60 for performance and stability improvements. Additionally, account session handling has been improved by fetching the session data during server-side processing and passing it to various components, thus optimizing the user experience.
This commit is contained in:
giancarlo
2024-04-06 14:34:05 +08:00
parent 9303e8f5dd
commit 67e9c8b676
8 changed files with 88 additions and 57 deletions

View File

@@ -26,9 +26,16 @@ export const loadTeamWorkspace = cache(async (accountSlug: string) => {
const accountsPromise = client.from('user_accounts').select('*');
const [accountResult, accountsResult] = await Promise.all([
const [
accountResult,
accountsResult,
{
data: { session },
},
] = await Promise.all([
accountPromise,
accountsPromise,
client.auth.getSession(),
]);
if (accountResult.error) {
@@ -56,5 +63,6 @@ export const loadTeamWorkspace = cache(async (accountSlug: string) => {
return {
account: accountData,
accounts: accountsResult.data,
session,
};
});