mirror of
https://github.com/hanskokx/arcane_framework.git
synced 2026-05-14 02:19:08 +02:00
v1.1.3
- Auth logout no longer throws exceptions, preferring a Result return value instead. Signed-off-by: Hans Kokx <hans.kokx@hackberry.se>
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
## 1.1.3
|
||||
|
||||
- Arcane Auth no longer throws exceptions when log out fails, instead returning a `Result<void, String>`. This behavior matches the login method.
|
||||
|
||||
## 1.1.2
|
||||
|
||||
- Removed Flutter exception handling from `ArcaneLoggingService`, as this functionality should be defined by a users' interface.
|
||||
|
||||
@@ -155,8 +155,10 @@ class ArcaneAuthenticationService extends ArcaneService {
|
||||
|
||||
/// Logs the current user out. Upon successful logout, `status` will be set to
|
||||
/// `AuthenticationStatus.unauthenticated`.
|
||||
Future<void> logOut({Future<void> Function()? onLoggedOut}) async {
|
||||
if (!isAuthenticated) return;
|
||||
Future<Result<void, String>> logOut({
|
||||
Future<void> Function()? onLoggedOut,
|
||||
}) async {
|
||||
if (!isAuthenticated) Result.error("User is not authenticated.");
|
||||
|
||||
assert(
|
||||
_authInterface != null,
|
||||
@@ -165,15 +167,12 @@ class ArcaneAuthenticationService extends ArcaneService {
|
||||
|
||||
final Result<void, String> loggedOut = await authInterface.logout();
|
||||
|
||||
await loggedOut.fold(
|
||||
onSuccess: (_) async {
|
||||
setUnauthenticated();
|
||||
if (onLoggedOut != null) await onLoggedOut();
|
||||
},
|
||||
onError: (e) {
|
||||
throw Exception(e);
|
||||
},
|
||||
);
|
||||
if (loggedOut.isSuccess) {
|
||||
setUnauthenticated();
|
||||
if (onLoggedOut != null) await onLoggedOut();
|
||||
}
|
||||
|
||||
return loggedOut;
|
||||
}
|
||||
|
||||
/// Logs the user in using an optional, generic `T` type of input.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
name: arcane_framework
|
||||
description: "Agnostic Reusable Component Architecture for New Ecosystems: a modern framework for bootstrapping new applications"
|
||||
version: 1.1.2
|
||||
version: 1.1.3
|
||||
repository: https://github.com/hanskokx/arcane_framework
|
||||
issue_tracker: https://github.com/hanskokx/arcane_framework/issues
|
||||
|
||||
|
||||
Reference in New Issue
Block a user