Initial commit
This commit is contained in:
17
MealPlan.Api/Services/AuthResult.cs
Normal file
17
MealPlan.Api/Services/AuthResult.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using MealPlan.Api.DTOs.Auth;
|
||||
|
||||
namespace MealPlan.Api.Services;
|
||||
|
||||
/// <summary>Outcome of an auth operation. Avoids throwing for expected failures (bad credentials, etc.).</summary>
|
||||
public class AuthResult
|
||||
{
|
||||
public bool Succeeded { get; private init; }
|
||||
public string? Error { get; private init; }
|
||||
public TokenResponseDto? Tokens { get; private init; }
|
||||
|
||||
public static AuthResult Success(TokenResponseDto tokens) =>
|
||||
new() { Succeeded = true, Tokens = tokens };
|
||||
|
||||
public static AuthResult Fail(string error) =>
|
||||
new() { Succeeded = false, Error = error };
|
||||
}
|
||||
Reference in New Issue
Block a user