PaulPatterson48 / INDIVIDUAL-ASSIGNMENT-Team-Roster

0 stars 0 forks source link

Read Members view all the members user created #10

Open PaulPatterson48 opened 11 months ago

PaulPatterson48 commented 11 months ago

User Story

GIVEN: As an authenticated user, I should be able to see the Team view with all the members I created

Acceptance Criteria

Google authentication limited to only the users associated with the login user

Dependecies

utils\auth.js

Dev Notes

/ eslint-disable react-hooks/exhaustive-deps / import React, { useEffect, useState } from 'react'; import Link from 'next/link'; import { Button } from 'react-bootstrap'; import { getBooks } from '../api/bookData'; import { useAuth } from '../utils/context/authContext'; import BookCard from '../components/BookCard';

function ShowBooks() { // TODO: Set a state for books const [books, setBooks] = useState([]);

// TODO: Get user ID using useAuth Hook const { user } = useAuth();

// TODO: create a function that makes the API call to get all the books const getAllTheBooks = () => { getBooks(user.uid).then(setBooks); };

// TODO: make the call to the API to get all the books on component render useEffect(() => { getAllTheBooks(); }, []);

return (

{/* TODO: map over books here using BookCard component */} {books.map((book) => ( ))}

); }

export default ShowBooks;