Skip to content

Commit d2de6ab

Browse files
committed
fix: Using API instead of direct github to bypass restrictions
1 parent 368cde3 commit d2de6ab

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/components/react/BlogPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function BlogPage() {
1010
useEffect(() => {
1111
fetch(`${import.meta.env.PUBLIC_API_URL}/api/gist/${slug}/`).then(async r => {
1212
setContent(insane(
13-
await marked.parse((await r.json())["files"]["content.md"]["content"] || "Not found"),
13+
await marked.parse((await r.json())["content"] || "Not found"),
1414
));
1515
}).catch((err) => {
1616
console.error(err)

src/components/react/BlogPost.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { useEffect, useState } from "react";
22

33
export default function Blog() {
4-
const URL = "https://api.github.com/users/etherbeing/gists?per_page=15";
54
const [posts, setPosts] = useState<
65
Array<{
76
id: string;
@@ -14,7 +13,7 @@ export default function Blog() {
1413
"justify-start" | "justify-center"
1514
>("justify-start");
1615
useEffect(() => {
17-
fetch(URL).then(async (response) => {
16+
fetch(`${import.meta.env.PUBLIC_API_URL}/api/gists/`).then(async (response) => {
1817
if (response.ok) {
1918
setPosts(await response.json());
2019
if (posts.length % 3 === 1) {

src/components/react/Projects.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface Repo {
1212
export default function Projects() {
1313
const [repos, setRepos] = useState<Array<Repo>>([]);
1414
useEffect(() => {
15-
fetch("https://api.github.com/users/etherbeing/repos?per_page=5").then(
15+
fetch(`${import.meta.env.PUBLIC_API_URL}/api/projects/`).then(
1616
async (res) => {
1717
if (res.ok) setRepos(await res.json())
1818
},

0 commit comments

Comments
 (0)