Patch JWT v2
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 4m57s
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 4m57s
This commit is contained in:
parent
4c6c7ab548
commit
5e7c71874a
@ -91,8 +91,32 @@ else
|
||||
{
|
||||
await RefreshAll();
|
||||
}
|
||||
// public async Task RefreshAll()
|
||||
// {
|
||||
// var response = await _httpClient.GetAsync("/api/Account/GetAllUsers");
|
||||
|
||||
// if (response.IsSuccessStatusCode)
|
||||
// {
|
||||
// var jsonResponse = await response.Content.ReadAsStringAsync();
|
||||
// var options = new JsonSerializerOptions
|
||||
// {
|
||||
// PropertyNameCaseInsensitive = true
|
||||
// };
|
||||
// var deserializedUsers = JsonSerializer.Deserialize<List<User>>(jsonResponse, options);
|
||||
// users = deserializedUsers ?? new List<User>();
|
||||
|
||||
// StateHasChanged();
|
||||
// }
|
||||
// }
|
||||
public async Task RefreshAll()
|
||||
{
|
||||
var customAuthStateProvider = (CustomAuthorizationProvider)authenticationStateProvider;
|
||||
var token = await customAuthStateProvider.GetTokenData();
|
||||
if (!string.IsNullOrWhiteSpace(token.token))
|
||||
{
|
||||
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.token);
|
||||
}
|
||||
|
||||
var response = await _httpClient.GetAsync("/api/Account/GetAllUsers");
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
@ -108,17 +132,26 @@ else
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void EditUser(string userId)
|
||||
{
|
||||
navigation.NavigateTo($"/userform/edit/{userId}");
|
||||
}
|
||||
|
||||
public async Task RecoveryPassword(string email)
|
||||
{
|
||||
var customAuthStateProvider = (CustomAuthorizationProvider)authenticationStateProvider;
|
||||
var token = await customAuthStateProvider.GetTokenData();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(token.token))
|
||||
{
|
||||
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.token);
|
||||
}
|
||||
|
||||
string url = $"api/Authentication/forgot-password?email={email}";
|
||||
|
||||
var response = await _httpClient.PostAsync(url,null);
|
||||
var response = await _httpClient.PostAsync(url, null);
|
||||
var message = await response.Content.ReadAsStringAsync();
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
toastService.ShowSuccess(message);
|
||||
@ -126,8 +159,23 @@ else
|
||||
else
|
||||
{
|
||||
toastService.ShowError(message);
|
||||
};
|
||||
}
|
||||
}
|
||||
// public async Task RecoveryPassword(string email)
|
||||
// {
|
||||
// string url = $"api/Authentication/forgot-password?email={email}";
|
||||
|
||||
// var response = await _httpClient.PostAsync(url,null);
|
||||
// var message = await response.Content.ReadAsStringAsync();
|
||||
// if (response.IsSuccessStatusCode)
|
||||
// {
|
||||
// toastService.ShowSuccess(message);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// toastService.ShowError(message);
|
||||
// };
|
||||
// }
|
||||
private void ConfirmDelete(string userId)
|
||||
{
|
||||
var parameters = new ModalParameters()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user