From 6034a161e743cbdca555dfabc2668aec42dea87a Mon Sep 17 00:00:00 2001 From: Sven Reichelt Date: Mon, 15 Jun 2020 15:35:03 +0200 Subject: [PATCH] Fixed ThemeService using tenant aware api calls --- Oqtane.Client/Services/ThemeService.cs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Oqtane.Client/Services/ThemeService.cs b/Oqtane.Client/Services/ThemeService.cs index 3e6a3690..bd349b93 100644 --- a/Oqtane.Client/Services/ThemeService.cs +++ b/Oqtane.Client/Services/ThemeService.cs @@ -1,28 +1,26 @@ -using Oqtane.Models; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Threading.Tasks; -using System.Reflection; -using System; +using Oqtane.Models; using Oqtane.Shared; namespace Oqtane.Services { public class ThemeService : ServiceBase, IThemeService { - private readonly HttpClient _http; + private readonly SiteState _siteState; - public ThemeService(HttpClient http) : base(http) + public ThemeService(HttpClient http, SiteState siteState) : base(http) { - _http = http; + _siteState = siteState; } - private string Apiurl => CreateApiUrl("Theme"); + private string ApiUrl => CreateApiUrl(_siteState.Alias, "Theme"); public async Task> GetThemesAsync() { - List themes = await GetJsonAsync>(Apiurl); + List themes = await GetJsonAsync>(ApiUrl); return themes.OrderBy(item => item.Name).ToList(); } @@ -45,12 +43,12 @@ namespace Oqtane.Services public async Task InstallThemesAsync() { - await GetJsonAsync>($"{Apiurl}/install"); + await GetJsonAsync>($"{ApiUrl}/install"); } public async Task DeleteThemeAsync(string themeName) { - await DeleteAsync($"{Apiurl}/{themeName}"); + await DeleteAsync($"{ApiUrl}/{themeName}"); } } }