Skip to content

Commit

Permalink
switchBranch
Browse files Browse the repository at this point in the history
  • Loading branch information
BuyankhuuTsCAl committed Apr 18, 2024
1 parent b5b9d5a commit 6f15259
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/api/supabase/queries/user_queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@ import { convertButtonNumberToCategory } from './button_queries';
*/
export async function fetchUser(): Promise<User> {
const {
data: { user },
data: { session },
error,
} = await supabase.auth.getUser();
} = await supabase.auth.getSession();

if (error) {
throw new Error(`Error fetching user: ${error.message}`);
throw new Error(`Error fetching session: ${error.message}`);
}

if (!session) {
throw new Error(`Session is null`);
}

const user = session.user;

if (user !== null) {
const { data, error: error1 } = await supabase
.from('profiles')
Expand Down
2 changes: 1 addition & 1 deletion src/app/[productId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function ItemDisplay({
<img
src={Item?.photo}
alt={Item?.name}
style={{ width: '400px', height: '400px' }}
style={{ width: '400px', height: '400px', objectFit: 'cover' }}
/>
</ImageContainer>
<TextContainer>
Expand Down

0 comments on commit 6f15259

Please sign in to comment.