Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only fetching submissions of current user #409

Merged
merged 2 commits into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions frontend/src/utils/fetches/FetchProjects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import {
ProjectDeadline,
ShortSubmission,
} from "../../pages/project/projectDeadline/ProjectDeadline.tsx";
import { Me } from "../../types/me.ts";
const API_URL = import.meta.env.VITE_APP_API_HOST;

export const fetchProjectPage = async () => {
const projects = await fetchProjects();
const me = await fetchMe();
const projects = await fetchProjects(me);
return { projects, me };
};

export const fetchProjects = async () => {
export const fetchProjects = async (me: Me) => {
try {
const response = await authenticatedFetch(`${API_URL}/projects`);
const jsonData = await response.json();
Expand All @@ -24,7 +25,7 @@ export const fetchProjects = async () => {
const project_id = url_split[url_split.length - 1];
const response_submissions = await (
await authenticatedFetch(
encodeURI(`${API_URL}/submissions?project_id=${project_id}`)
encodeURI(`${API_URL}/submissions?project_id=${project_id}&uid=${me.uid}`)
)
).json();

Expand Down