Make `failure` parameter of `Popover.ajaxApi()` optional
authorMatthias Schmidt <gravatronics@live.com>
Tue, 29 Jun 2021 08:00:44 +0000 (10:00 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 29 Jun 2021 08:00:55 +0000 (10:00 +0200)
There is no reason to make the custom failure callback a required parameter here because in most cases, there is no need fur such a custom handler.

ts/WoltLabSuite/Core/Controller/Popover.ts

index 6bd30fd3075faf0996761e975ddcda036632f906..fb798ede51b0ca0af55d2a654f40f169910f0e18 100644 (file)
@@ -433,7 +433,7 @@ class ControllerPopover implements AjaxCallbackObject {
   /**
    * Sends an AJAX requests to the server, simple wrapper to reuse the request object.
    */
-  ajaxApi(data: RequestPayload, success: CallbackSuccess, failure: CallbackFailure): void {
+  ajaxApi(data: RequestPayload, success: CallbackSuccess, failure?: CallbackFailure): void {
     if (typeof success !== "function") {
       throw new TypeError("Expected a valid callback for parameter 'success'.");
     }