improve performance of alias handling and allow aliases to be an unlimited number of subfolders in depth
This commit is contained in:
@ -2,7 +2,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
|
||||
@ -12,29 +11,23 @@ namespace Oqtane.Services
|
||||
{
|
||||
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
|
||||
public ProfileService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
{
|
||||
|
||||
public ProfileService(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Profile"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl(_siteState.Alias, "Profile");
|
||||
|
||||
public async Task<List<Profile>> GetProfilesAsync(int siteId)
|
||||
{
|
||||
List<Profile> profiles = await GetJsonAsync<List<Profile>>($"{Apiurl}?siteid={siteId.ToString()}");
|
||||
List<Profile> profiles = await GetJsonAsync<List<Profile>>($"{Apiurl}?siteid={siteId}");
|
||||
return profiles.OrderBy(item => item.ViewOrder).ToList();
|
||||
}
|
||||
|
||||
public async Task<Profile> GetProfileAsync(int profileId)
|
||||
{
|
||||
return await GetJsonAsync<Profile>($"{Apiurl}/{profileId.ToString()}");
|
||||
return await GetJsonAsync<Profile>($"{Apiurl}/{profileId}");
|
||||
}
|
||||
|
||||
public async Task<Profile> AddProfileAsync(Profile profile)
|
||||
@ -44,11 +37,11 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Profile> UpdateProfileAsync(Profile profile)
|
||||
{
|
||||
return await PutJsonAsync<Profile>($"{Apiurl}/{profile.SiteId.ToString()}", profile);
|
||||
return await PutJsonAsync<Profile>($"{Apiurl}/{profile.SiteId}", profile);
|
||||
}
|
||||
public async Task DeleteProfileAsync(int profileId)
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{profileId.ToString()}");
|
||||
await DeleteAsync($"{Apiurl}/{profileId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user