Skip to content

Commit

Permalink
chore: remove unused github token code
Browse files Browse the repository at this point in the history
  • Loading branch information
pajecawav committed Feb 8, 2024
1 parent d4f2df9 commit 05498e8
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 201 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hot-toast": "^2.4.1",
"tiny-server-timing": "^0.1.5",
"zustand": "^4.5.0"
"tiny-server-timing": "^0.1.5"
},
"devDependencies": {
"@types/js-cookie": "^3.0.6",
Expand Down
34 changes: 3 additions & 31 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

112 changes: 0 additions & 112 deletions src/components/GitHubTokenModal.tsx

This file was deleted.

18 changes: 0 additions & 18 deletions src/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ import { ReactNode, useState } from "react";
import { FirefoxIcon } from "../icons/FirefoxIcon";
import { track } from "@vercel/analytics";

const GitHubTokenModal = dynamic(() =>
import("../GitHubTokenModal").then(mod => mod.GitHubTokenModal),
);

type Props = {
className?: string;
};
Expand Down Expand Up @@ -54,20 +50,6 @@ export const Header = ({ className }: Props) => {
{theme === Theme.light ? <MoonIcon /> : <SunIcon />}
</button>
</HeaderItem>
{/* <HeaderItem> */}
{/* <button */}
{/* className="w-full h-full" */}
{/* onClick={() => setIsTokenModalOpen(true)} */}
{/* title="Open GitHub token settings" */}
{/* > */}
{/* <CogIcon /> */}
{/* </button> */}
{/* {isTokenModalOpen && ( */}
{/* <GitHubTokenModal */}
{/* onClose={() => setIsTokenModalOpen(false)} */}
{/* /> */}
{/* )} */}
{/* </HeaderItem> */}
<HeaderItem>
<a
href="https://github.com/pajecawav/ghloc-web"
Expand Down
19 changes: 0 additions & 19 deletions src/lib/github.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useTokenStore } from "@/stores/useTokenStore";
import { isClient } from "@/utils";
import dayjs from "dayjs";
import { $fetch, createFetchError } from "ofetch";
Expand All @@ -8,12 +7,6 @@ import { GITHUB_TOKEN } from "./ssr";
function createClientFetcher() {
return $fetch.create({
retry: 0,
async onRequest({ options }) {
options.headers = {
...(options.headers || {}),
...getGitHubAuthHeaders(),
};
},
async onResponseError(error) {
if (error.response?.status === 403) {
const limit = parseInt(
Expand Down Expand Up @@ -64,18 +57,6 @@ const ghFetcher = isClient() ? createClientFetcher() : createServerFetcher();

export class GitHubActivityCalculationStartedError extends Error {}

function getGitHubAuthHeaders(): Record<string, string> {
const { token } = useTokenStore.getState();

if (!token) {
return {};
}

return {
Authorization: `token ${token}`,
};
}

export function getRawGitHubUrl({
owner,
repo,
Expand Down
19 changes: 0 additions & 19 deletions src/stores/useTokenStore.ts

This file was deleted.

0 comments on commit 05498e8

Please sign in to comment.