This commit is contained in:
skidoodle 2023-12-13 15:09:16 +01:00
parent 5e46ceb833
commit b612d2327d
2 changed files with 2 additions and 4 deletions

View file

@ -11,9 +11,7 @@ const CustomButton: React.FC<ButtonProps> = ({ label, link }) => {
if (link) { if (link) {
try { try {
setIsLoading(true) setIsLoading(true)
const response = await fetch( const response = await fetch(`/api/validate?link=${encodeURI(link)}`)
`/api/validate?link=${encodeURIComponent(link)}`
)
const data = (await response.json()) as { status: number } const data = (await response.json()) as { status: number }
setStatus(data.status) setStatus(data.status)
} catch (error) { } catch (error) {

View file

@ -14,7 +14,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
const address = req.headers.host const address = req.headers.host
const baseUrl = `https://dload-oktatas.educatio.hu/erettsegi/feladatok_${ev}${idoszak}_${szint}/` const baseUrl = `https://dload-oktatas.educatio.hu/erettsegi/feladatok_${ev}${idoszak}_${szint}/`
const proxiedUrl = `${protocol}://${address}/api/proxy?link=${encodeURIComponent( const proxiedUrl = `${protocol}://${address}/api/proxy?link=${encodeURI(
baseUrl baseUrl
)}` )}`