Skip to content

Commit

Permalink
feat: added user deletion options in session repository
Browse files Browse the repository at this point in the history
  • Loading branch information
dmacan23 committed Feb 29, 2024
1 parent bbbb79e commit 977b11e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/domain/remote/estate_sales/auth_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ abstract class _AuthAPI {
@Body() Map<String, dynamic> map,
@Queries() Map<String, dynamic> queries,
);

@DELETE('/auth/users/{id}')
Future<void> delete(@Path('id') int id);
}

class AuthAPI extends __AuthAPI {
Expand Down
7 changes: 7 additions & 0 deletions lib/domain/repository/session_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ class SessionRepository {
return _hive.sessionStore.delete();
}

Future<void> deleteUser() async {
final session = await _hive.sessionStore.get();
final id = session!.user.id;
await _api.auth.delete(id);
await _hive.sessionStore.delete();
}

Future<UserDashboard> getUserDashboard() {
return _api.users.dashboard();
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: estatesales_sdk
description: A new Flutter project.
version: 0.1.0
version: 0.1.1
homepage:

environment:
Expand Down

0 comments on commit 977b11e

Please sign in to comment.