@@ -23,7 +23,7 @@ export default function loadComments (event: CurrentEvent): void
2323 } ;
2424 var event_comment_avatar = id ( "event_comment_avatar" ) ;
2525 Object . keys ( attributes ) . forEach ( attr =>
26- event_comment_avatar . setAttribute ( attr , ( attributes [ attr ] as string | number ) . toString ( ) ) ) ;
26+ event_comment_avatar . setAttribute ( attr , ( attributes [ attr as keyof typeof attributes ] as string | number ) . toString ( ) ) ) ;
2727
2828 var event_comments = id ( 'event_comments' ) ;
2929 event_comments . innerHTML = '<div class="spinner-border m-auto" role="status"></div>' ;
@@ -39,7 +39,7 @@ export default function loadComments (event: CurrentEvent): void
3939 } ,
4040 function ( type : string , ex : XMLHttpRequest )
4141 {
42- CheckAuthentication ( ex ) ;
42+ CheckAuthentication ( ex , event . event_id ) ;
4343
4444 event_comments . innerHTML = '' ; // Remove spinner
4545 console . error ( type , ex . responseText ) ;
@@ -51,11 +51,11 @@ export default function loadComments (event: CurrentEvent): void
5151 } ) ;
5252}
5353
54- function CheckAuthentication ( ex : XMLHttpRequest )
54+ function CheckAuthentication ( ex : XMLHttpRequest , event_id : number )
5555{
5656 if ( ex . status === 401 )
5757 {
58- window . location . assign ( '/login' ) ;
58+ window . location . assign ( '/login?dest=' + encodeURIComponent ( '/event:' + event_id ) ) ;
5959 }
6060}
6161
@@ -306,7 +306,7 @@ function registerToEvent (event_id: number, interest: number, button_id: string,
306306 } ,
307307 function ( type : string , ex : XMLHttpRequest )
308308 {
309- CheckAuthentication ( ex ) ;
309+ CheckAuthentication ( ex , event_id ) ;
310310 console . error ( type , ex ) ;
311311 } ) ;
312312}
@@ -320,7 +320,7 @@ function unregisterFromEvent (event_id: number, button_id: string, container: HT
320320 } ,
321321 function ( type : string , ex : XMLHttpRequest )
322322 {
323- CheckAuthentication ( ex ) ;
323+ CheckAuthentication ( ex , event_id ) ;
324324 console . error ( type , ex ) ;
325325 } ) ;
326326}
0 commit comments