Fixed: Mark as Failed errors

This commit is contained in:
Mark McDowall 2021-02-08 19:26:06 -08:00
parent 795bc91d25
commit 12fafb2457
3 changed files with 14 additions and 11 deletions

View File

@ -86,11 +86,8 @@ export const actionHandlers = handleThunks({
} = payload;
const promise = createAjaxRequest({
url: '/history/failed',
method: 'POST',
data: {
id: historyId
}
url: `/history/failed/${historyId}`,
method: 'POST'
}).request;
promise.done(() => {

View File

@ -244,11 +244,9 @@ export const actionHandlers = handleThunks({
}));
const promise = createAjaxRequest({
url: '/history/failed',
url: `/history/failed/${id}`,
method: 'POST',
data: {
id
}
dataType: 'json'
}).request;
promise.done(() => {

View File

@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Nancy;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.Download;
using NzbDrone.Core.History;
@ -33,6 +31,8 @@ namespace Sonarr.Api.V3.History
Get("/since", x => GetHistorySince());
Get("/series", x => GetSeriesHistory());
Post("/failed", x => MarkAsFailed());
Post(@"/failed/(?<id>[\d]{1,10})", x => MarkAsFailed((int)x.Id));
}
protected HistoryResource MapToResource(EpisodeHistory model, bool includeSeries, bool includeEpisode)
@ -143,10 +143,18 @@ namespace Sonarr.Api.V3.History
return _historyService.GetBySeries(seriesId, eventType).Select(h => MapToResource(h, includeSeries, includeEpisode)).ToList();
}
// v4 TODO: Getting the ID from the form is atypical, consider removing.
private object MarkAsFailed()
{
var id = (int)Request.Form.Id;
return MarkAsFailed(id);
}
private object MarkAsFailed(int id)
{
_failedDownloadService.MarkAsFailed(id);
return new object();
}
}