Skip to content

Commit

Permalink
Merge pull request #17 from the-collab-lab/mz-dj-add-auth
Browse files Browse the repository at this point in the history
Add conditional sign in and sign out button
  • Loading branch information
nathanejbrown authored Aug 11, 2024
2 parents db3435a + a54aecf commit 8a02fe9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/api/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './firebase';
export { useAuth } from './useAuth';
export { useAuth, SignInButton, SignOutButton } from './useAuth';
5 changes: 4 additions & 1 deletion src/views/Layout.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Outlet } from 'react-router-dom';

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

/**
* TODO: The links defined in this file don't work!
Expand All @@ -12,13 +12,16 @@ 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>
</header>
<main className="Layout-main">
{user ? <SignOutButton /> : <SignInButton />}

<Outlet />
</main>
<nav className="Nav">
Expand Down

0 comments on commit 8a02fe9

Please sign in to comment.