From b7e0116df872e2a654285c2a9ad984ea96be123f Mon Sep 17 00:00:00 2001 From: Kevin Cai Date: Wed, 1 Nov 2023 18:50:39 -0700 Subject: [PATCH] Done --- src/api/supabase/queries/tests/user_test.ts | 12 ++++++------ src/api/supabase/queries/user_queries.ts | 2 -- src/schema/schema.ts | 1 - 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/api/supabase/queries/tests/user_test.ts b/src/api/supabase/queries/tests/user_test.ts index a5b62227..e720d4c9 100644 --- a/src/api/supabase/queries/tests/user_test.ts +++ b/src/api/supabase/queries/tests/user_test.ts @@ -75,15 +75,15 @@ export async function fullCartTest() { await incrementCartItemByOne(testUserId, testItemId); await incrementCartItemByOne(testUserId, testItemId); await incrementCartItemByOne(testUserId, testItemId); - let result_1 = await fetchUserCart(testUserId); - console.log('fetchUserCart Result_1:', result_1); + let result1 = await fetchUserCart(testUserId); + console.log('fetchUserCart Result_1:', result1); await decrementCartItemByOne(testUserId, testItemId); - result_1 = await fetchUserCart(testUserId); - console.log('fetchUserCart Result_2:', result_1); + result1 = await fetchUserCart(testUserId); + console.log('fetchUserCart Result_2:', result1); await decrementCartItem(testUserId, testItemId, 6); - const result_3 = await fetchUserCart(testUserId); - console.log('fetchUserCart Result_3:', result_3); + const result3 = await fetchUserCart(testUserId); + console.log('fetchUserCart Result_3:', result3); } catch (error) { console.error('Error in incrementCartItemByOne:', error); } diff --git a/src/api/supabase/queries/user_queries.ts b/src/api/supabase/queries/user_queries.ts index 6e3969d6..f9180e22 100644 --- a/src/api/supabase/queries/user_queries.ts +++ b/src/api/supabase/queries/user_queries.ts @@ -61,7 +61,6 @@ export async function updateCart( userId: string, currentCart: Record, ) { - const { data, error } = await supabase .from('profiles') .update({ cart: currentCart }) @@ -79,7 +78,6 @@ export async function incrementCartItem( itemId: string, n: number, ) { - // First, fetch the current cart for the user const { data, error }: { data: User | null; error: PostgrestError | null } = await supabase.from('profiles').select('*').eq('user_id', userId).single(); diff --git a/src/schema/schema.ts b/src/schema/schema.ts index 2132d8e3..4338e25d 100644 --- a/src/schema/schema.ts +++ b/src/schema/schema.ts @@ -35,4 +35,3 @@ export type Product = { photo: string; // text null; updated_at: string; // timestamp with time zone not null default now(); }; -