Skip to content

Commit

Permalink
fix: iframe error
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Oct 15, 2023
1 parent b8a20bd commit 2acb45a
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions app/(empty)/iframe/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
"use client"
import { fetchRepos } from "@/app/api/github"
import { GhUserUse } from "@/app/api/types"
import { calParams } from "@/utils/svg"
import { useSearchParams } from "next/navigation"
import { useEffect, useState } from "react"

export default async function () {
export default function () {
const searchParams = useSearchParams()

const repos = searchParams.getAll("repo")
const users = await fetchRepos(repos)
const [users, setUsers] = useState<GhUserUse[]>([])
async function fetchUsers() {
try {
const resp = await fetch("/api/json?" + searchParams.toString())
setUsers(await resp.json())
} catch (e) {}
}
useEffect(() => {
fetchUsers()
}, [])
if (users.length === 0) {
return <div>loading...</div>
}
const params = calParams({
cols: searchParams.get("cols"),
radius: searchParams.get("radius"),
Expand Down

0 comments on commit 2acb45a

Please sign in to comment.