mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
added JsonErrorFilter to automatically handle failing ajax calls.
This commit is contained in:
parent
7c6d745c86
commit
b8ac694fc4
5 changed files with 73 additions and 38 deletions
|
@ -1,3 +1,5 @@
|
|||
using System.Web.Mvc;
|
||||
|
||||
namespace NzbDrone.Web.Models
|
||||
{
|
||||
public class NotificationResult
|
||||
|
@ -7,13 +9,31 @@ namespace NzbDrone.Web.Models
|
|||
Text = string.Empty;
|
||||
}
|
||||
|
||||
public bool IsMessage { get { return true; } }
|
||||
|
||||
public string Title { get; set; }
|
||||
public string Text { get; set; }
|
||||
public NotificationType NotificationType { get; set; }
|
||||
|
||||
|
||||
public static JsonResult Info(string title, string text)
|
||||
{
|
||||
return GetJsonResult(NotificationType.Error, title, text);
|
||||
}
|
||||
|
||||
public static JsonResult Error(string title, string text)
|
||||
{
|
||||
return GetJsonResult(NotificationType.Error, title, text);
|
||||
}
|
||||
|
||||
public static JsonResult GetJsonResult(NotificationType notificationType, string title, string text)
|
||||
{
|
||||
return new JsonResult
|
||||
{
|
||||
Data = new NotificationResult { NotificationType = notificationType, Title = title, Text = text },
|
||||
ContentType = null,
|
||||
ContentEncoding = null,
|
||||
JsonRequestBehavior = JsonRequestBehavior.AllowGet
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public enum NotificationType
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue