Replace session with user in various files
This change mainly involves replacing 'session' with 'user' in various files in several applications. The function calls related to 'session' have been refactored to reflect 'user'. The '@supabase/supabase-js' package dependency has
This commit is contained in:
@@ -3,32 +3,13 @@ import { cache } from 'react';
|
||||
import { getSupabaseServerComponentClient } from '@kit/supabase/server-component-client';
|
||||
|
||||
export const loadUserWorkspace = cache(async () => {
|
||||
const [accounts, session] = await Promise.all([
|
||||
loadUserAccounts(),
|
||||
loadSession(),
|
||||
]);
|
||||
const accounts = await loadUserAccounts();
|
||||
|
||||
return {
|
||||
accounts,
|
||||
session,
|
||||
};
|
||||
});
|
||||
|
||||
async function loadSession() {
|
||||
const client = getSupabaseServerComponentClient();
|
||||
|
||||
const {
|
||||
data: { session },
|
||||
error,
|
||||
} = await client.auth.getSession();
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
return session;
|
||||
}
|
||||
|
||||
async function loadUserAccounts() {
|
||||
const client = getSupabaseServerComponentClient();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user