mirror of
https://github.com/System-End/site.git
synced 2026-04-19 16:28:21 +00:00
Don't proxy replit stats requests through a nextjs api route
This commit is contained in:
parent
bf1a6aab2a
commit
cac4ed883a
3 changed files with 1 additions and 26 deletions
|
|
@ -95,7 +95,6 @@
|
|||
"remark": "^15.0.1",
|
||||
"remark-gfm": "^3.0.1",
|
||||
"remark-html": "^16.0.1",
|
||||
"socket.io": "^4.7.5",
|
||||
"styled-components": "^6.1.8",
|
||||
"swr": "^2.2.4",
|
||||
"theme-ui": "^0.14",
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
export default async function handler(req, res) {
|
||||
if (req.method === 'GET') {
|
||||
try {
|
||||
const response = await fetch('http://takeout.hackclub.com/stats')
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`)
|
||||
}
|
||||
|
||||
const data = await response.json()
|
||||
|
||||
res.status(200).json(data)
|
||||
} catch (error) {
|
||||
console.error('Error processing signup:', error)
|
||||
res
|
||||
.status(500)
|
||||
.json({ message: 'Error processing signup', error: error.message })
|
||||
}
|
||||
} else {
|
||||
// Handle any non-POST requests
|
||||
res.setHeader('Allow', ['POST'])
|
||||
res.status(405).end(`Method ${req.method} Not Allowed`)
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ const ReplitPage = () => {
|
|||
const [stats, setStats] = useState(null)
|
||||
|
||||
const fetchStats = async () => {
|
||||
const statResponse = await fetch('/api/replit/stats')
|
||||
const statResponse = await fetch('http://takeout.hackclub.com/stats')
|
||||
if (!statResponse.ok) throw new Error('Failed to fetch stats')
|
||||
const statData = await statResponse.json()
|
||||
console.info(statData)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue