@@ -23,7 +23,7 @@ export async function downloadFile(url: string, filename: string) {
23
23
link . download = filename ;
24
24
link . click ( ) ;
25
25
window . URL . revokeObjectURL ( link . href ) ;
26
- } catch ( error ) { }
26
+ } catch ( error ) { }
27
27
}
28
28
29
29
const CatalogueContent = ( ) => {
@@ -76,7 +76,7 @@ const CatalogueContent = () => {
76
76
try {
77
77
const papersResponse = await axios . get < Filters > ( "/api/papers" , {
78
78
params : { subject } ,
79
- } ) ;
79
+ } ) ; g
80
80
const data : Filters = papersResponse . data ;
81
81
const papersData = data . papers ;
82
82
setFilterOptions ( data ) ;
@@ -99,7 +99,7 @@ const CatalogueContent = () => {
99
99
? selectedCampuses . includes ( paper . campus )
100
100
: true ;
101
101
const answerkeyCondition = selectedAnswerKeyIncluded
102
- ? paper . answerKeyIncluded
102
+ ? paper . answerKeyIncluded === true
103
103
: true ;
104
104
return (
105
105
examCondition &&
@@ -118,7 +118,7 @@ const CatalogueContent = () => {
118
118
setError (
119
119
axios . isAxiosError ( axiosError )
120
120
? ( ( axiosError . response ?. data as { message ?: string } ) ?. message ??
121
- "Error fetching papers" )
121
+ "Error fetching papers" )
122
122
: "Error fetching papers" ,
123
123
) ;
124
124
} finally {
@@ -149,13 +149,21 @@ const CatalogueContent = () => {
149
149
) ;
150
150
151
151
const handleDownloadAll = useCallback ( async ( ) => {
152
+ /* if (typeof window !== "undefined" && window.gtag) {
153
+ window.gtag("event", "download_all_clicked", {
154
+ event_category: "Paper Downloads",
155
+ event_label: "Download All Clicked",
156
+ });
157
+ } */
158
+
152
159
for ( const paper of selectedPapers ) {
153
160
const extension = paper . finalUrl . split ( "." ) . pop ( ) ;
154
161
const fileName = `${ extractBracketContent ( paper . subject ) } -${ paper . exam } -${ paper . slot } -${ paper . year } .${ extension } ` ;
155
162
await downloadFile ( paper . finalUrl , fileName ) ;
156
163
}
157
164
} , [ selectedPapers ] ) ;
158
165
166
+
159
167
const handleApplyFilters = useCallback (
160
168
(
161
169
exams : string [ ] ,
@@ -198,7 +206,7 @@ const CatalogueContent = () => {
198
206
const campusCondition = campus . length
199
207
? campus . includes ( paper . campus )
200
208
: true ;
201
- const answerkeyCondition = anskey ? paper . answerKeyIncluded : true ;
209
+ const answerkeyCondition = anskey ? paper . answerKeyIncluded === true : true ;
202
210
return (
203
211
examCondition &&
204
212
slotCondition &&
0 commit comments