From 9ce958f9198179382965dba38ce55b675f0f24d9 Mon Sep 17 00:00:00 2001 From: zhangtao25 Date: Wed, 20 Nov 2024 10:43:22 +0800 Subject: [PATCH] chore: repo overall update --- .../[id]/commits/[sha]/[...filepath]/page.tsx | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/packages/canyon-platform/app/projects/[id]/commits/[sha]/[...filepath]/page.tsx b/packages/canyon-platform/app/projects/[id]/commits/[sha]/[...filepath]/page.tsx index 7ddcc125..564b9f40 100644 --- a/packages/canyon-platform/app/projects/[id]/commits/[sha]/[...filepath]/page.tsx +++ b/packages/canyon-platform/app/projects/[id]/commits/[sha]/[...filepath]/page.tsx @@ -9,23 +9,34 @@ import axios from "axios"; import MainBox from "@/components/main-box"; // http://localhost:3000/projects/123/commits/xxx/main/nihao/nihao/main.js +// http://localhost:3000/projects/59069994/commits/47bc7263d0ebf506bcfbaa2c053495bfc5d2c74a/src/main.ts -const fetcher = (url) => +const fetcher = ({ url, params }) => axios .get(url, { - params: {}, + params: params, }) .then((res) => res.data); export default function Page() { const { p, filepath, id, sha } = useParams(); // 获取动态路由参数 - // console.log(p, filepath, id, sha, Report); + console.log(p, filepath, id, sha); // p 是一个数组,包含路径的各个部分 - const filePath = p ? p.join("/") : "文件路径未找到"; + const filePath = filepath ? filepath.join("/") : "文件路径未找到"; const spar = {}; - const { data } = useSWR("/api/cov/map", fetcher); + const { data } = useSWR( + { + url: "/api/cov/map", + params: { + project_id: id, + sha, + filepath: filePath, + }, + }, + fetcher, + ); return (