Stop the root folder and profile calls from erroring

pull/2420/head^2
TidusJar 7 years ago
parent 58af83959e
commit 63a1d41597

@ -11,9 +11,9 @@ using Ombi.Settings.Settings.Models.External;
namespace Ombi.Controllers.External
{
[Admin]
[ApiV1]
[Produces("application/json")]
[Admin]
[ApiV1]
[Produces("application/json")]
public class SonarrController : Controller
{
public SonarrController(ISonarrApi sonarr, ISettingsService<SonarrSettings> settings)
@ -55,7 +55,11 @@ namespace Ombi.Controllers.External
public async Task<IEnumerable<SonarrProfile>> GetProfiles()
{
var settings = await SonarrSettings.GetSettingsAsync();
return await SonarrApi.GetProfiles(settings.ApiKey, settings.FullUri);
if (settings.Enabled)
{
return await SonarrApi.GetProfiles(settings.ApiKey, settings.FullUri);
}
return null;
}
/// <summary>
@ -66,7 +70,12 @@ namespace Ombi.Controllers.External
public async Task<IEnumerable<SonarrRootFolder>> GetRootFolders()
{
var settings = await SonarrSettings.GetSettingsAsync();
return await SonarrApi.GetRootFolders(settings.ApiKey, settings.FullUri);
if (settings.Enabled)
{
return await SonarrApi.GetRootFolders(settings.ApiKey, settings.FullUri);
}
return null;
}
}
}
Loading…
Cancel
Save