refactor user deletion

This commit is contained in:
Shaun Walker
2021-03-29 12:58:40 -04:00
parent 7223952eb2
commit d8bcc32239
7 changed files with 50 additions and 29 deletions

View File

@ -85,7 +85,7 @@ else
var user = await UserService.GetUserAsync(UserRole.UserId, PageState.Site.SiteId);
if (user != null)
{
await UserService.DeleteUserAsync(user.UserId);
await UserService.DeleteUserAsync(user.UserId, PageState.Site.SiteId);
await logger.LogInformation("User Deleted {User}", UserRole.User);
StateHasChanged();
}

View File

@ -1,4 +1,4 @@
using Oqtane.Models;
using Oqtane.Models;
using System.Threading.Tasks;
namespace Oqtane.Services
@ -13,7 +13,7 @@ namespace Oqtane.Services
Task<User> UpdateUserAsync(User user);
Task DeleteUserAsync(int userId);
Task DeleteUserAsync(int userId, int siteId);
Task<User> LoginUserAsync(User user, bool setCookie, bool isPersistent);

View File

@ -1,4 +1,4 @@
using Oqtane.Shared;
using Oqtane.Shared;
using Oqtane.Models;
using System.Net.Http;
using System.Threading.Tasks;
@ -36,9 +36,9 @@ namespace Oqtane.Services
return await PutJsonAsync<User>($"{Apiurl}/{user.UserId}", user);
}
public async Task DeleteUserAsync(int userId)
public async Task DeleteUserAsync(int userId, int siteId)
{
await DeleteAsync($"{Apiurl}/{userId}");
await DeleteAsync($"{Apiurl}/{userId}?siteid={siteId}");
}
public async Task<User> LoginUserAsync(User user, bool setCookie, bool isPersistent)