From 2fbca1d9c02d5fbbf078c164448109dcc4a9d148 Mon Sep 17 00:00:00 2001 From: moon Date: Tue, 6 Feb 2024 23:22:37 -0800 Subject: [PATCH] terminal fixes --- packages/terminal/src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/terminal/src/index.ts b/packages/terminal/src/index.ts index b15467b..55259be 100644 --- a/packages/terminal/src/index.ts +++ b/packages/terminal/src/index.ts @@ -53,9 +53,9 @@ const getSupabase = (access_token?: string) => { } export const getMe = async (session: { access_token: string | undefined }) => { - const { data: { user }, error} = await getSupabase(session.access_token).auth.getUser() + const { data: { user }, error} = await getSupabase(session?.access_token).auth.getUser() if (error) { - await getSupabase(session.access_token).auth.signOut(); + await getSupabase(session?.access_token).auth.signOut(); console.log('*** error', error) return null; } else { @@ -71,7 +71,7 @@ async function startApplication() { // Assuming session information is stored in the .cjrc file const userData = JSON.parse(fs.readFileSync(configFile).toString()); const session = userData?.session; - const supabase = getSupabase(session.access_token); + const supabase = getSupabase(session?.access_token); let user = null as any; if (session) { // Get user information or perform any other session-related initialization here