FixAuth
This commit is contained in:
@@ -1,15 +1,18 @@
|
||||
using Entities.DTO;
|
||||
using System.Net.Http.Json;
|
||||
using System.Net.Http.Json;
|
||||
using TechHelper.Client.HttpRepository;
|
||||
|
||||
namespace TechHelper.Client.Services
|
||||
{
|
||||
public class ClasssServices : IClassServices
|
||||
{
|
||||
private readonly HttpClient _client;
|
||||
private readonly IAuthenticationClientService _authenticationClientService;
|
||||
|
||||
public ClasssServices(HttpClient client)
|
||||
public ClasssServices(HttpClient client, IAuthenticationClientService authenticationClientService)
|
||||
{
|
||||
_client = client;
|
||||
_authenticationClientService = authenticationClientService;
|
||||
}
|
||||
|
||||
public Task<ResponseDto> CreateClass(UserRegistrationToClassDto userClass)
|
||||
@@ -25,6 +28,8 @@ namespace TechHelper.Client.Services
|
||||
userRegistrationToClassDto);
|
||||
var data = await result.Content.ReadAsStringAsync();
|
||||
|
||||
await _authenticationClientService.RefreshTokenAsync();
|
||||
|
||||
return new ResponseDto
|
||||
{
|
||||
IsSuccessfulRegistration = result.IsSuccessStatusCode,
|
||||
|
@@ -9,13 +9,13 @@ namespace TechHelper.Client.Services
|
||||
{
|
||||
public class ExamService : IExamService
|
||||
{
|
||||
private readonly IAIService _aIService; // 遵循命名规范,字段前加下划线
|
||||
private readonly HttpClient _client; // 直接注入 HttpClient
|
||||
private readonly IAIService _aIService;
|
||||
private readonly HttpClient _client;
|
||||
|
||||
public ExamService(IAIService aIService, HttpClient client) // 修正点:直接注入 HttpClient
|
||||
public ExamService(IAIService aIService, HttpClient client)
|
||||
{
|
||||
_aIService = aIService;
|
||||
_client = client; // 赋值注入的 HttpClient 实例
|
||||
_client = client;
|
||||
}
|
||||
|
||||
public ApiResponse ConvertToXML<T>(string xmlContent)
|
||||
|
Reference in New Issue
Block a user