@ -260,6 +260,7 @@ export function initGlobalLinkActions() {
e . preventDefault ( ) ;
e . preventDefault ( ) ;
const $this = $ ( this ) ;
const $this = $ ( this ) ;
const redirect = $this . data ( 'redirect' ) ;
const redirect = $this . data ( 'redirect' ) ;
$this . prop ( 'disabled' , true ) ;
$ . post ( $this . data ( 'url' ) , {
$ . post ( $this . data ( 'url' ) , {
_csrf : csrfToken
_csrf : csrfToken
} ) . done ( ( data ) => {
} ) . done ( ( data ) => {
@ -270,6 +271,8 @@ export function initGlobalLinkActions() {
} else {
} else {
window . location . reload ( ) ;
window . location . reload ( ) ;
}
}
} ) . always ( ( ) => {
$this . prop ( 'disabled' , false ) ;
} ) ;
} ) ;
}
}
@ -283,11 +286,14 @@ export function initGlobalLinkActions() {
// FIXME: this is only used once, and should be replace with `link-action` instead
// FIXME: this is only used once, and should be replace with `link-action` instead
$ ( '.undo-button' ) . on ( 'click' , function ( ) {
$ ( '.undo-button' ) . on ( 'click' , function ( ) {
const $this = $ ( this ) ;
const $this = $ ( this ) ;
$this . prop ( 'disabled' , true ) ;
$ . post ( $this . data ( 'url' ) , {
$ . post ( $this . data ( 'url' ) , {
_csrf : csrfToken ,
_csrf : csrfToken ,
id : $this . data ( 'id' )
id : $this . data ( 'id' )
} ) . done ( ( data ) => {
} ) . done ( ( data ) => {
window . location . href = data . redirect ;
window . location . href = data . redirect ;
} ) . always ( ( ) => {
$this . prop ( 'disabled' , false ) ;
} ) ;
} ) ;
} ) ;
} ) ;
}
}