File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export const getAbsenceEvents = async (): Promise<EventAttributes[]> => {
2929 title : `${ absence . subject . name } : ${ absence . absentTeacher . firstName } ${ absence . absentTeacher . lastName [ 0 ] } ${ substituteTeacherString } ` ,
3030 description : `Subject: ${ absence . subject . name } \nLesson Plan: ${ lessonString } ${ notesLine } ` ,
3131 location : absence . location . name ,
32+ calName : 'Sistema Absences' ,
3233 } ;
3334 } ) ;
3435 } catch ( err ) {
Original file line number Diff line number Diff line change @@ -24,8 +24,16 @@ export async function GET(
2424 return NextResponse . json ( { error : 'File not found' } , { status : 404 } ) ;
2525 }
2626
27- return new Response ( icsFile , {
28- headers : { 'Content-Type' : 'text/calendar' } ,
27+ // convert file to response
28+ const buffer = await icsFile . arrayBuffer ( ) ;
29+ const blob = new Blob ( [ buffer ] , { type : 'text/calendar' } ) ;
30+
31+ return new Response ( blob , {
32+ status : 200 ,
33+ headers : {
34+ 'Content-Type' : 'text/calendar' ,
35+ 'Content-Disposition' : `attachment; filename=${ id } ` ,
36+ } ,
2937 } ) ;
3038 } catch ( error ) {
3139 console . error ( 'Error fetching ICS file:' , error ) ;
You can’t perform that action at this time.
0 commit comments