Skip to content

Commit

Permalink
front end updates for todo, getOne displaying in details
Browse files Browse the repository at this point in the history
  • Loading branch information
Kh1ng committed Apr 13, 2024
1 parent aca99cd commit bebfe77
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ function App() {
<BrowserRouter>
<h1> NEAT-O </h1>
<Routes>
<Route path="/details/" element={<Details />} />
<Route path="/" element={<div> ROOT TOOTY </div>} />
<Route path="/details/" element={<Details />} />
</Routes>
</BrowserRouter>
</QueryClientProvider>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/bin/fetchOne.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fetchOne = async ({ queryKey }) => {
var id = queryKey[1];
id = "65efb787a6f9a056e81397e8";
id = "661a82c1e8f6d03e467a4a5d";
const apiRes = await fetch(`http://localhost:3000/api/getOne/${id}`);

if (!apiRes.ok) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/bin/getAll.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const getAll = async (queryKey) => {
throw new Error(`getAll fetch not ok`);
}

return apiRes.json();
return apiRes;
};

export default getAll;
12 changes: 9 additions & 3 deletions frontend/src/components/details.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ const Details = () => {
return <div>ERROR!@#!@#!#!@#</div>;
}

const name = data.name;

return <div>{name}</div>;
const todo = data.todo;
console.log(data.completed)
return (
<div className="todo">
<div>{todo}</div>
<div>ID: {data._id}</div>
<div>Due: {data.due}</div>
</div>
);
};
export default Details;

0 comments on commit bebfe77

Please sign in to comment.