-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Made progress towards task detail view
- Loading branch information
1 parent
aba06f4
commit 636dd6d
Showing
11 changed files
with
107 additions
and
6 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import axios from "axios"; | ||
|
||
import { useState, useEffects, useEffect } from "react"; | ||
import { useParams } from "react-router-dom"; | ||
import { useProjectContext } from "../Context/ProjectContext"; | ||
|
||
import Navbar from "./Navbar"; | ||
import Footer from "./Footer"; | ||
import NotLoggedIn from "./NotLoggedIn"; | ||
|
||
export default function TaskDetail () { | ||
const {id} = useParams(); | ||
const {token, login} = useProjectContext(); | ||
const [task, setTask] = useState({}); | ||
const [project, setProject] = useState({}); | ||
|
||
const fetchTaskData = async() => { | ||
await axios.get(`http://127.0.0.1:8000/api/tasks/${id}/`, { | ||
headers: { | ||
Authorization: `Token ${token}` | ||
} | ||
}) | ||
.then(res => { | ||
console.log(res.data); | ||
setTask(res.data); | ||
}) | ||
.catch(err => { | ||
console.log(err); | ||
}) | ||
} | ||
|
||
useEffect(() => { | ||
fetchTaskData(); | ||
}, [token]) | ||
|
||
if (!login) { | ||
return <NotLoggedIn /> | ||
} | ||
return ( | ||
<div className="page-container"> | ||
<Navbar /> | ||
<div className="container task-detail-container"> | ||
<div className="main-body"> | ||
<header> | ||
<h1 className="pg-heading">{task.project.title}</h1> | ||
<p className="pg-heading-secondary">({task.title})</p> | ||
</header> | ||
</div> | ||
<aside className="proj-sidebar"> | ||
<h2 className="sidebar-heading pg-heading">Project Info</h2> | ||
</aside> | ||
</div> | ||
<Footer /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters