-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
107: Added logic to store auth tokens in local storage
- Loading branch information
Showing
10 changed files
with
141 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace ASSISTENTE.UI.Auth.Models; | ||
|
||
public sealed class AuthResponse | ||
{ | ||
private AuthResponse() | ||
{ | ||
IsSuccess = true; | ||
} | ||
|
||
private AuthResponse(AuthError error) | ||
{ | ||
IsSuccess = false; | ||
Error = error; | ||
} | ||
|
||
public bool IsSuccess { get; set; } | ||
public AuthError? Error { get; set; } | ||
|
||
public static AuthResponse Success() => new(); | ||
|
||
public static AuthResponse Fail(AuthError? error) => error != null | ||
? new AuthResponse(error) | ||
: new AuthResponse(new AuthError("UnknownError", "Unknown error")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
namespace ASSISTENTE.UI.Auth.Models; | ||
|
||
public record AuthStore(string AccessToken, string RefreshToken); | ||
public sealed record AuthStore(string AccessToken, string RefreshToken); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
namespace ASSISTENTE.UI.Auth.Providers.Models; | ||
|
||
public record LoginDto(string Email, string Password); | ||
public sealed record LoginDto(string Email, string Password); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
namespace ASSISTENTE.UI.Auth.Providers.Models; | ||
|
||
public record RedirectDto(string AccessToken, string RefreshToken); | ||
public sealed record RedirectDto(string AccessToken, string RefreshToken); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
namespace ASSISTENTE.UI.Auth.Providers.Models; | ||
|
||
public record RegisterDto(string Username, string Email, string Password); | ||
public sealed record RegisterDto(string Username, string Email, string Password); |