Skip to content

Commit

Permalink
Fixed file url
Browse files Browse the repository at this point in the history
  • Loading branch information
usserwoutV2 committed May 23, 2024
1 parent 00e256a commit 8691428
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion frontend/src/pages/project/components/SubmissionsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const SubmissionsTable: FC<{ submissions: ProjectSubmissionsType[] | null; onCha

const downloadSubmission = async (submission: ProjectSubmissionsType) => {
if (!submission.submission) return console.error("No submission found");
downloadFile(submission.submission.fileUrl, submission.group.name + ".zip");
downloadFile(submission.submission.fileUrl.replace("/api/", "/web/api/") as ApiRoutes.SUBMISSION_FILE, submission.group.name + ".zip");
if (withArtifacts && submission.submission.artifactUrl) {
downloadFile(submission.submission.artifactUrl, submission.group.name + "-artifacts.zip");
}
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/pages/submission/components/SubmissionCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Card, theme, Button, Space } from "antd"
import { useTranslation } from "react-i18next"
import { GET_Responses } from "../../../@types/requests"
import { ApiRoutes } from "../../../@types/requests"
import { GET_Responses,ApiRoutes } from "../../../@types/requests.d"
import { ArrowLeftOutlined, DownloadOutlined } from "@ant-design/icons"
import { useLocation, useNavigate } from "react-router-dom"
import "@fontsource/jetbrains-mono"
Expand All @@ -18,16 +17,17 @@ const SubmissionCard: React.FC<{ submission: SubmissionType }> = ({ submission }
const location = useLocation()
const index = new URLSearchParams(location.search).get("index")


console.log(submission);
const downloadFile = async (route: ApiRoutes.SUBMISSION_FILE | ApiRoutes.SUBMISSION_ARTIFACT, filename: string) => {

const response = await API.GET(
route,
route.replace("/api/","/web/api/") as ApiRoutes.SUBMISSION_FILE,
{
config: {
responseType: "blob",
transformResponse: [(data) => data],
},

},
"message"
)
Expand Down

0 comments on commit 8691428

Please sign in to comment.