mirror of
https://github.com/skidoodle/erettsegi-browser.git
synced 2026-04-28 13:37:35 +02:00
minor changes pt.2
This commit is contained in:
+7
-6
@@ -9,25 +9,26 @@ export const fetchData = async (
|
||||
setutPdfLink: (link: string) => void
|
||||
) => {
|
||||
try {
|
||||
let url = `/api/erettsegi?vizsgatargy=${selectedSubject}&ev=${selectedYear}&idoszak=${selectedPeriod}&szint=${selectedLevel}`
|
||||
const url = `/api/erettsegi?vizsgatargy=${selectedSubject}&ev=${selectedYear}&idoszak=${selectedPeriod}&szint=${selectedLevel}`
|
||||
|
||||
const response = await fetch(url)
|
||||
|
||||
if (response.ok) {
|
||||
const data = await response.json()
|
||||
const data = (await response.json()) as {
|
||||
flZipUrl: string
|
||||
utZipUrl: string
|
||||
flPdfUrl: string
|
||||
utPdfUrl: string
|
||||
}
|
||||
|
||||
if (data.utZipUrl && data.flZipUrl) {
|
||||
setflZipLink(data.flZipUrl)
|
||||
setutZipLink(data.utZipUrl)
|
||||
} else {
|
||||
console.error('Nincs érvényes ZIP link a válaszban.')
|
||||
}
|
||||
|
||||
if (data.utPdfUrl && data.flPdfUrl) {
|
||||
setflPdfLink(data.flPdfUrl)
|
||||
setutPdfLink(data.utPdfUrl)
|
||||
} else {
|
||||
console.error('Nincs érvényes PDF link a válaszban.')
|
||||
}
|
||||
} else {
|
||||
console.error('Hiba történt az API hívás során.')
|
||||
|
||||
@@ -10,3 +10,8 @@ export interface SelectorProps {
|
||||
setSelectedPeriod: React.Dispatch<React.SetStateAction<string>>
|
||||
setSelectedLevel: React.Dispatch<React.SetStateAction<string>>
|
||||
}
|
||||
|
||||
export interface ButtonProps {
|
||||
label: string
|
||||
link: string
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
export type ButtonColor =
|
||||
| 'primary'
|
||||
| 'danger'
|
||||
| 'default'
|
||||
| 'secondary'
|
||||
| 'success'
|
||||
| 'warning'
|
||||
| undefined
|
||||
Reference in New Issue
Block a user