1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-21 22:05:38 -04:00

Convert EditSeriesModal to TypeScript

This commit is contained in:
Mark McDowall
2024-11-23 16:47:47 -08:00
parent e361f18837
commit 2f62494adc
18 changed files with 529 additions and 450 deletions
@@ -1,19 +1,15 @@
interface AjaxResponse {
responseJSON:
| {
message: string | undefined;
}
| undefined;
}
import { Error } from 'App/State/AppSectionState';
function getErrorMessage(xhr: AjaxResponse, fallbackErrorMessage?: string) {
if (!xhr || !xhr.responseJSON || !xhr.responseJSON.message) {
function getErrorMessage(xhr: Error, fallbackErrorMessage?: string) {
if (!xhr || !xhr.responseJSON) {
return fallbackErrorMessage;
}
const message = xhr.responseJSON.message;
if ('message' in xhr.responseJSON && xhr.responseJSON.message) {
return xhr.responseJSON.message;
}
return message || fallbackErrorMessage;
return fallbackErrorMessage;
}
export default getErrorMessage;