X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=resources%2Fsrc%2Fmediawiki.page.ready.js;h=0e59da624bbe052c353c01ac42388e8a96f2afc7;hb=568631af97fdde99d1b218776c94b298c0fb171e;hp=4eba81d5ca963316a034b3332c1d1c5d1701ebc8;hpb=701b642fdc55de095e050cc56d65c61225473a06;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/mediawiki.page.ready.js b/resources/src/mediawiki.page.ready.js index 4eba81d5ca..0e59da624b 100644 --- a/resources/src/mediawiki.page.ready.js +++ b/resources/src/mediawiki.page.ready.js @@ -56,22 +56,25 @@ // Turn logout to a POST action $( '#pt-logout a' ).on( 'click', function ( e ) { - var api = new mw.Api(), returnUrl; - returnUrl = $( '#pt-logout a' ).attr( 'href' ); + var api = new mw.Api(), + returnUrl = $( '#pt-logout a' ).attr( 'href' ); mw.notify( mw.message( 'logging-out-notify' ), { tag: 'logout', autoHide: false } ); api.postWithToken( 'csrf', { action: 'logout' - } ).done( function () { - window.location = returnUrl; - } ).fail( function ( e ) { - mw.notify( - mw.message( 'logout-failed', e ), - { type: 'error', tag: 'logout', autoHide: false } - ); - } ); + } ).then( + function () { + location.href = returnUrl; + }, + function ( e ) { + mw.notify( + mw.message( 'logout-failed', e ), + { type: 'error', tag: 'logout', autoHide: false } + ); + } + ); e.preventDefault(); } ); } );