mirror of
https://github.com/hanskokx/arcane_framework.git
synced 2026-05-14 10:29:06 +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
|
## 1.1.2
|
||||||
|
|
||||||
- Removed Flutter exception handling from `ArcaneLoggingService`, as this functionality should be defined by a users' interface.
|
- 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
|
/// Logs the current user out. Upon successful logout, `status` will be set to
|
||||||
/// `AuthenticationStatus.unauthenticated`.
|
/// `AuthenticationStatus.unauthenticated`.
|
||||||
Future<void> logOut({Future<void> Function()? onLoggedOut}) async {
|
Future<Result<void, String>> logOut({
|
||||||
if (!isAuthenticated) return;
|
Future<void> Function()? onLoggedOut,
|
||||||
|
}) async {
|
||||||
|
if (!isAuthenticated) Result.error("User is not authenticated.");
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
_authInterface != null,
|
_authInterface != null,
|
||||||
@@ -165,15 +167,12 @@ class ArcaneAuthenticationService extends ArcaneService {
|
|||||||
|
|
||||||
final Result<void, String> loggedOut = await authInterface.logout();
|
final Result<void, String> loggedOut = await authInterface.logout();
|
||||||
|
|
||||||
await loggedOut.fold(
|
if (loggedOut.isSuccess) {
|
||||||
onSuccess: (_) async {
|
|
||||||
setUnauthenticated();
|
setUnauthenticated();
|
||||||
if (onLoggedOut != null) await onLoggedOut();
|
if (onLoggedOut != null) await onLoggedOut();
|
||||||
},
|
}
|
||||||
onError: (e) {
|
|
||||||
throw Exception(e);
|
return loggedOut;
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Logs the user in using an optional, generic `T` type of input.
|
/// Logs the user in using an optional, generic `T` type of input.
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
name: arcane_framework
|
name: arcane_framework
|
||||||
description: "Agnostic Reusable Component Architecture for New Ecosystems: a modern framework for bootstrapping new applications"
|
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
|
repository: https://github.com/hanskokx/arcane_framework
|
||||||
issue_tracker: https://github.com/hanskokx/arcane_framework/issues
|
issue_tracker: https://github.com/hanskokx/arcane_framework/issues
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user