Skip to content

Commit

Permalink
chore: daily development
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangtao25 committed Dec 30, 2024
1 parent e1f0796 commit b593643
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 111 deletions.
1 change: 0 additions & 1 deletion packages/canyon-platform/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<script src="/0.0.1/main.js"></script>
</body>
</html>
64 changes: 0 additions & 64 deletions packages/canyon-platform/public/0.0.1/main.js

This file was deleted.

Empty file.
1 change: 0 additions & 1 deletion packages/canyon-platform/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import "./useWorker.ts";
import "./i18n.ts";
import "antd/dist/reset.css";
import "./index.css";
import "./collect.js";

import {
ApolloClient,
Expand Down
51 changes: 6 additions & 45 deletions packages/canyon-platform/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,60 +21,21 @@ const theme = localStorage.getItem("theme") || "light";
// console.log(theme, 'theme');
function Index() {
const { t } = useTranslation();
const loc = useLocation();
const nav = useNavigate();

useEffect(() => {
setMenuSelectedKey(loc.pathname.replace("/", ""));
document.title = genTitle(loc.pathname);
if (localStorage.getItem("token") === null) {
localStorage.clear();
localStorage.setItem("callback", window.location.href);
nav("/login");
}
}, []);

const loc = useLocation();
const nav = useNavigate();

useEffect(() => {
if (loc.pathname === "/") {
} else if (loc.pathname === "/"){
nav("/projects");
}
document.title = genTitle(loc.pathname);

try {
// @ts-ignore
if (meData?.me.email && window.__coverage__) {
// @ts-ignore
const __canyon__ = ((global.__coverage__ && (Object.keys(global.__coverage__).length > 0)) ? Object.values(global.__coverage__)[0] : undefined);
// @ts-ignore
fetch(__canyon__.dsn, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${localStorage.getItem("token")}`,
},
body: JSON.stringify({
// @ts-ignore
coverage: window.__coverage__,
// @ts-ignore
commitSha: __canyon__.commitSha,
// @ts-ignore
sha: __canyon__.sha,
// @ts-ignore
projectID: __canyon__.projectID,
// @ts-ignore
instrumentCwd: __canyon__.instrumentCwd,
reportID: `${meData?.me.email}|${loc.pathname}`,
// @ts-ignore
branch: __canyon__.branch,
}),
});
}
} catch (e) {
// console.log(e);
}
}, [loc.pathname]);

useEffect(() => {
setMenuSelectedKey(loc.pathname.replace("/", ""));
}, [loc.pathname]);
const { data: meData } = useQuery(MeDocument);
useEffect(() => {
localStorage.setItem("username", meData?.me.email || "");
Expand Down

0 comments on commit b593643

Please sign in to comment.