mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 02:33:01 +00:00
get projects by owner
This commit is contained in:
@@ -4,8 +4,8 @@ import { IssueDetailPane } from "@/components/issue-detail-pane";
|
|||||||
import { IssuesTable } from "@/components/issues-table";
|
import { IssuesTable } from "@/components/issues-table";
|
||||||
import SmallUserDisplay from "@/components/small-user-display";
|
import SmallUserDisplay from "@/components/small-user-display";
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||||
|
import { getAuthHeaders } from "@/lib/utils";
|
||||||
import LogOutButton from "./components/log-out-button";
|
import LogOutButton from "./components/log-out-button";
|
||||||
import { getAuthHeaders } from "./lib/utils";
|
|
||||||
|
|
||||||
function Index() {
|
function Index() {
|
||||||
const serverURL = import.meta.env.SERVER_URL?.trim() || "http://localhost:3000";
|
const serverURL = import.meta.env.SERVER_URL?.trim() || "http://localhost:3000";
|
||||||
@@ -20,7 +20,7 @@ function Index() {
|
|||||||
if (projectsRef.current) return;
|
if (projectsRef.current) return;
|
||||||
projectsRef.current = true;
|
projectsRef.current = true;
|
||||||
|
|
||||||
fetch(`${serverURL}/projects/all`, { headers: getAuthHeaders() })
|
fetch(`${serverURL}/projects/by-owner?ownerId=${user.id}`, { headers: getAuthHeaders() })
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
.then((data: ProjectResponse[]) => {
|
.then((data: ProjectResponse[]) => {
|
||||||
setProjects(data);
|
setProjects(data);
|
||||||
@@ -28,7 +28,7 @@ function Index() {
|
|||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error("error fetching projects:", err);
|
console.error("error fetching projects:", err);
|
||||||
});
|
});
|
||||||
}, []);
|
}, [user.id]);
|
||||||
|
|
||||||
const [selectedIssue, setSelectedIssue] = useState<IssueResponse | null>(null);
|
const [selectedIssue, setSelectedIssue] = useState<IssueResponse | null>(null);
|
||||||
const [issuesData, setIssues] = useState<IssueResponse[]>([]);
|
const [issuesData, setIssues] = useState<IssueResponse[]>([]);
|
||||||
|
|||||||
Reference in New Issue
Block a user