diff --git a/src/components/profile/Profile.js b/src/components/profile/Profile.js index e456295..7924023 100644 --- a/src/components/profile/Profile.js +++ b/src/components/profile/Profile.js @@ -8,7 +8,7 @@ export const Profile = () => { useEffect( () => { - fetch("http://localhost:8088/trackedCards?_expand=cardDataId") + fetch("http://localhost:8088/trackedCards?_expand=cardData") .then(res => res.json()) .then(setcurrentUsertrackedcards) }, []) @@ -18,10 +18,44 @@ export const Profile = () => { .then(res => res.json()) .then(fetchUsers) }, []) + + // useEffect = ( + // () = { + + // }, [currentUsertrackedcards] + // ) +// const showprofileinfo = () => { +// Users.filter((user) => { +// if (user.id === currentuser) +// } + + + + + + + const removetrackedcard = (gpudataobj) => { + + const trackedcardtodeleteobj = { + id: gpudataobj.id, + userId: gpudataobj.userId, + cardDataId: gpudataobj.txt + } + const deletefetchfortrackedcards = { + method: "DELETE", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(trackedcardtodeleteobj), + } + + return fetch("http://localhost:8088/trackedCards", deletefetchfortrackedcards) + } return( <> {/* why is my code returning duplicate elements?*/} -

returning something. This is a test

+

My Tracked Cards

+

{}

@@ -36,18 +70,19 @@ export const Profile = () => { gpudataobj => { return ( <> -

{ - gpudataobj.cardDataId.oem + { + gpudataobj.cardData.oem } { - gpudataobj.cardDataId.brand + gpudataobj.cardData.brand } { - gpudataobj.cardDataId.model + gpudataobj.cardData.model } { - gpudataobj.cardDataId.price - }

{ - + gpudataobj.cardData.price.toLocaleString('en-US', { + style: 'currency', + currency: 'USD' + }) + } { + } )
Brand