diff --git a/typo3/sysext/backend/Resources/Private/TypeScript/AjaxDataHandler.ts b/typo3/sysext/backend/Resources/Private/TypeScript/AjaxDataHandler.ts index 9fea6d61fa65..5429e18499aa 100644 --- a/typo3/sysext/backend/Resources/Private/TypeScript/AjaxDataHandler.ts +++ b/typo3/sysext/backend/Resources/Private/TypeScript/AjaxDataHandler.ts @@ -12,6 +12,8 @@ */ import {SeverityEnum} from './Enum/Severity'; +import MessageInterface from './AjaxDataHandler/MessageInterface'; +import ResponseInterface from './AjaxDataHandler/ResponseInterface'; import * as $ from 'jquery'; import Icons = require('./Icons'); import Modal = require('./Modal'); @@ -24,18 +26,6 @@ enum Identifiers { icon = '.t3js-icon' } -interface Message { - title: string; - message: string; - severity: SeverityEnum; -} - -interface Response { - redirect: string; - messages: Array; - hasErrors: boolean; -} - /** * Module: TYPO3/CMS/Backend/AjaxDataHandler * AjaxDataHandler - Javascript functions to work with AJAX and interacting with tce_db.php @@ -63,7 +53,7 @@ class AjaxDataHandler { * @returns {JQueryPromise} */ public process(parameters: Object): JQueryPromise { - return this._call(parameters).done((result: Response): void => { + return this._call(parameters).done((result: ResponseInterface): void => { if (result.hasErrors) { this.handleErrors(result); } @@ -83,7 +73,7 @@ class AjaxDataHandler { this._showSpinnerIcon($iconElement); // make the AJAX call to toggle the visibility - this._call(params).done((result: Response): void => { + this._call(params).done((result: ResponseInterface): void => { // print messages on errors if (result.hasErrors) { this.handleErrors(result); @@ -193,7 +183,7 @@ class AjaxDataHandler { this._showSpinnerIcon($iconElement); // make the AJAX call to toggle the visibility - this._call(params).done((result: Response): void => { + this._call(params).done((result: ResponseInterface): void => { // revert to the old class Icons.getIcon('actions-edit-delete', Icons.sizes.small).done((icon: string): void => { $iconElement = $anchorElement.find(Identifiers.icon); @@ -237,8 +227,8 @@ class AjaxDataHandler { * * @param {Object} result */ - private handleErrors(result: Response): void { - $.each(result.messages, (position: number, message: Message): void => { + private handleErrors(result: ResponseInterface): void { + $.each(result.messages, (position: number, message: MessageInterface): void => { Notification.error(message.title, message.message); }); } diff --git a/typo3/sysext/backend/Resources/Private/TypeScript/AjaxDataHandler/MessageInterface.ts b/typo3/sysext/backend/Resources/Private/TypeScript/AjaxDataHandler/MessageInterface.ts new file mode 100644 index 000000000000..cdb70e3532fe --- /dev/null +++ b/typo3/sysext/backend/Resources/Private/TypeScript/AjaxDataHandler/MessageInterface.ts @@ -0,0 +1,18 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ + +export default interface MessageInterface { + title: string; + message: string; + severity: number; +} diff --git a/typo3/sysext/backend/Resources/Private/TypeScript/AjaxDataHandler/ResponseInterface.ts b/typo3/sysext/backend/Resources/Private/TypeScript/AjaxDataHandler/ResponseInterface.ts new file mode 100644 index 000000000000..e30dfc9686db --- /dev/null +++ b/typo3/sysext/backend/Resources/Private/TypeScript/AjaxDataHandler/ResponseInterface.ts @@ -0,0 +1,20 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ + +import MessageInterface from './MessageInterface'; + +export default interface ResponseInterface { + redirect: string; + messages: Array; + hasErrors: boolean; +} diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler/MessageInterface.js b/typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler/MessageInterface.js new file mode 100644 index 000000000000..d580a287e270 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler/MessageInterface.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +define(["require","exports"],function(e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0})}); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler/ResponseInterface.js b/typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler/ResponseInterface.js new file mode 100644 index 000000000000..d580a287e270 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler/ResponseInterface.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +define(["require","exports"],function(e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0})}); \ No newline at end of file