Skip to content

Commit

Permalink
implement sign in and sign out
Browse files Browse the repository at this point in the history
  • Loading branch information
Amaka202 committed Feb 4, 2024
1 parent a9de895 commit 56e5884
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/views/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Outlet } from 'react-router-dom';

import './Layout.css';
import { auth } from '../api/config.js';
import {SignInButton, SignOutButton, useAuth} from "../api/useAuth.jsx";
import { SignInButton, SignOutButton, useAuth } from '../api/useAuth.jsx';

/**
* TODO: The links defined in this file don't work!
Expand All @@ -13,14 +13,15 @@ import {SignInButton, SignOutButton, useAuth} from "../api/useAuth.jsx";
*/

export function Layout() {

const user = useAuth()
const { user } = useAuth();

return (
<>
<div className="Layout">
<header className="Layout-header">
<h1>Smart shopping list</h1>
<p>{user?.displayName ? `Welcome ${user?.displayName}` : null}</p>
{!!user ? <SignOutButton /> : <SignInButton />}
</header>
<main className="Layout-main">
<Outlet />
Expand Down

0 comments on commit 56e5884

Please sign in to comment.