mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-25 19:15:18 +02:00
hard code the repo name and repo owner
This commit is contained in:
parent
14dd57815e
commit
9af7ea51f6
1 changed files with 2 additions and 9 deletions
|
|
@ -3,9 +3,6 @@
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
export const useGithubStars = () => {
|
export const useGithubStars = () => {
|
||||||
const repo = process.env.NEXT_PUBLIC_GITHUB_REPO;
|
|
||||||
const owner = process.env.NEXT_PUBLIC_GITHUB_OWNER;
|
|
||||||
|
|
||||||
const [stars, setStars] = useState<number | null>(null);
|
const [stars, setStars] = useState<number | null>(null);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
@ -14,13 +11,9 @@ export const useGithubStars = () => {
|
||||||
const abortController = new AbortController();
|
const abortController = new AbortController();
|
||||||
const getStars = async () => {
|
const getStars = async () => {
|
||||||
try {
|
try {
|
||||||
if (!repo || !owner) {
|
|
||||||
throw new Error("Missing GitHub credentials");
|
|
||||||
}
|
|
||||||
|
|
||||||
setError(null);
|
setError(null);
|
||||||
|
|
||||||
const response = await fetch(`https://api.github.com/repos/${owner}/${repo}`, {
|
const response = await fetch(`https://api.github.com/repos/MODSetter/SurfSense`, {
|
||||||
signal: abortController.signal,
|
signal: abortController.signal,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -46,7 +39,7 @@ export const useGithubStars = () => {
|
||||||
return () => {
|
return () => {
|
||||||
abortController.abort();
|
abortController.abort();
|
||||||
};
|
};
|
||||||
}, [repo, owner]);
|
}, []);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
stars,
|
stars,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue