18 lines
588 B
C#
18 lines
588 B
C#
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 };
|
|
}
|