Skip to content

Commit

Permalink
Merge pull request #16 from the-collab-lab/mz-rb-auth
Browse files Browse the repository at this point in the history
Add Auth to the app
  • Loading branch information
llunaplanet committed Feb 4, 2024
2 parents 805c462 + 8ec7157 commit 4692296
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/views/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +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';

/**
* TODO: The links defined in this file don't work!
Expand All @@ -12,11 +13,23 @@ import { auth } from '../api/config.js';
*/

export function Layout() {
const { user } = useAuth();

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

0 comments on commit 4692296

Please sign in to comment.