Media poster methods added

This commit is contained in:
2024-09-11 15:59:13 +02:00
Unverified
parent 5b871714fa
commit cc22e609e1
15 changed files with 250 additions and 24 deletions

View File

@@ -4,9 +4,10 @@ using System.Text.Json;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.Extensions.Logging;
using WatchIt.Common.Model.Accounts;
using WatchIt.Website.Services.Utility.Tokens;
using WatchIt.Website.Services.WebAPI.Accounts;
namespace WatchIt.Website.Services.Utility.Tokens;
namespace WatchIt.Website.Services.Utility.Authentication;
public class JWTAuthenticationStateProvider : AuthenticationStateProvider
{
@@ -111,13 +112,20 @@ public class JWTAuthenticationStateProvider : AuthenticationStateProvider
private async Task<string?> Refresh(string refreshToken)
{
AuthenticateResponse response = null;
AuthenticateResponse? response = null;
await _accountsService.AuthenticateRefresh((data) => response = data);
if (response is not null)
{
await _tokensService.SaveAuthenticationData(response);
}
else
{
await _tokensService.RemoveAuthenticationData();
}
await _tokensService.SaveAuthenticationData(response);
return response.AccessToken;
return response?.AccessToken;
}
private static IEnumerable<Claim> GetClaimsFromToken(string token)

View File

@@ -7,6 +7,9 @@ public class Media
public string PostGenre { get; set; }
public string DeleteGenre { get; set; }
public string GetPhotoMediaRandomBackground { get; set; }
public string GetPoster { get; set; }
public string PutPoster { get; set; }
public string DeletePoster { get; set; }
public string GetPhoto { get; set; }
public string GetPhotos { get; set; }
public string GetPhotoRandomBackground { get; set; }