Skip to content

Commit

Permalink
chore: daily development
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangtao25 committed Jan 7, 2025
1 parent 71de57a commit 69db631
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
21 changes: 21 additions & 0 deletions packages/canyon-platform/src/helpers/utils/reportCoverage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export function reportCoverage() {
try {
// @ts-ignore
const canyon = window.__coverage__[0];
return fetch(canyon.dsn,{
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${localStorage.getItem("token")}`,
},
method: "POST",
body: JSON.stringify({
...canyon,
// @ts-ignore
coverage: window.__coverage__,
reportID: localStorage.getItem("username")||undefined,
}),
})
} catch (e) {
return Promise.resolve();
}
}
4 changes: 3 additions & 1 deletion packages/canyon-platform/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import {
import { MeDocument } from "../helpers/backend/gen/graphql.ts";
import { genBreadcrumbItems } from "../layouts/genBreadcrumbItems.tsx";
import { genTitle } from "../layouts/genTitle.ts";
import {reportCoverage} from "@/helpers/utils/reportCoverage.ts";
const theme = localStorage.getItem("theme") || "light";
// console.log(theme, 'theme');

function Index() {
const { t } = useTranslation();
const loc = useLocation();
Expand All @@ -34,6 +35,7 @@ function Index() {
} else if (loc.pathname === "/"){
nav("/projects");
}
reportCoverage();
}, [loc.pathname]);

const { data: meData } = useQuery(MeDocument);
Expand Down

0 comments on commit 69db631

Please sign in to comment.