👽 Update API to microservices

♻️ Refactor router pushes
This commit is contained in:
2025-07-17 14:35:09 +08:00
parent a7454edec0
commit e6c58b7b63
109 changed files with 9156 additions and 344 deletions

View File

@@ -28,14 +28,14 @@ part 'settings.g.dart';
@riverpod
Future<List<SnAuthFactor>> authFactors(Ref ref) async {
final client = ref.read(apiClientProvider);
final res = await client.get('/accounts/me/factors');
final res = await client.get('/id/accounts/me/factors');
return res.data.map<SnAuthFactor>((e) => SnAuthFactor.fromJson(e)).toList();
}
@riverpod
Future<List<SnContactMethod>> contactMethods(Ref ref) async {
final client = ref.read(apiClientProvider);
final resp = await client.get('/accounts/me/contacts');
final resp = await client.get('/id/accounts/me/contacts');
return resp.data
.map<SnContactMethod>((e) => SnContactMethod.fromJson(e))
.toList();
@@ -44,7 +44,7 @@ Future<List<SnContactMethod>> contactMethods(Ref ref) async {
@riverpod
Future<List<SnAccountConnection>> accountConnections(Ref ref) async {
final client = ref.read(apiClientProvider);
final resp = await client.get('/accounts/me/connections');
final resp = await client.get('/id/accounts/me/connections');
return resp.data
.map<SnAccountConnection>((e) => SnAccountConnection.fromJson(e))
.toList();
@@ -68,7 +68,7 @@ class AccountSettingsScreen extends HookConsumerWidget {
try {
showLoadingModal(context);
final client = ref.read(apiClientProvider);
await client.delete('/accounts/me');
await client.delete('/id/accounts/me');
if (context.mounted) {
showSnackBar('accountDeletionSent'.tr());
}

View File

@@ -6,7 +6,7 @@ part of 'settings.dart';
// RiverpodGenerator
// **************************************************************************
String _$authFactorsHash() => r'4bb65bc0c065c4091c209ee81e57ddef41051ae2';
String _$authFactorsHash() => r'24fe2f7b375b019d87fc3b85cbedbe857f399c0f';
/// See also [authFactors].
@ProviderFor(authFactors)
@@ -25,7 +25,7 @@ final authFactorsProvider =
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
typedef AuthFactorsRef = AutoDisposeFutureProviderRef<List<SnAuthFactor>>;
String _$contactMethodsHash() => r'4d7952fc196dce4dc646314565a49c115fd1d292';
String _$contactMethodsHash() => r'76a1a93f61c51c44b32b4821f5112d58406155f0';
/// See also [contactMethods].
@ProviderFor(contactMethods)
@@ -45,7 +45,7 @@ final contactMethodsProvider =
// ignore: unused_element
typedef ContactMethodsRef = AutoDisposeFutureProviderRef<List<SnContactMethod>>;
String _$accountConnectionsHash() =>
r'38a309d596e0ea2539cd92ea86984e1e4fb346e4';
r'9f69e7f23e3e53c528d38b93d76f0c9efc9a83db';
/// See also [accountConnections].
@ProviderFor(accountConnections)

View File

@@ -31,7 +31,7 @@ class AuthFactorSheet extends HookConsumerWidget {
try {
showLoadingModal(context);
final client = ref.read(apiClientProvider);
await client.delete('/accounts/me/factors/${factor.id}');
await client.delete('/id/accounts/me/factors/${factor.id}');
if (context.mounted) Navigator.pop(context, true);
} catch (err) {
showErrorAlert(err);
@@ -49,7 +49,7 @@ class AuthFactorSheet extends HookConsumerWidget {
try {
showLoadingModal(context);
final client = ref.read(apiClientProvider);
await client.post('/accounts/me/factors/${factor.id}/disable');
await client.post('/id/accounts/me/factors/${factor.id}/disable');
if (context.mounted) Navigator.pop(context, true);
} catch (err) {
showErrorAlert(err);

View File

@@ -74,7 +74,7 @@ class AccountConnectionSheet extends HookConsumerWidget {
try {
showLoadingModal(context);
final client = ref.read(apiClientProvider);
await client.delete('/accounts/me/connections/${connection.id}');
await client.delete('/id/accounts/me/connections/${connection.id}');
if (context.mounted) Navigator.pop(context, true);
} catch (err) {
showErrorAlert(err);

View File

@@ -25,7 +25,7 @@ class ContactMethodSheet extends HookConsumerWidget {
try {
showLoadingModal(context);
final client = ref.read(apiClientProvider);
await client.delete('/accounts/me/contacts/${contact.id}');
await client.delete('/id/accounts/me/contacts/${contact.id}');
if (context.mounted) Navigator.pop(context, true);
} catch (err) {
showErrorAlert(err);
@@ -38,7 +38,7 @@ class ContactMethodSheet extends HookConsumerWidget {
try {
showLoadingModal(context);
final client = ref.read(apiClientProvider);
await client.post('/accounts/me/contacts/${contact.id}/verify');
await client.post('/id/accounts/me/contacts/${contact.id}/verify');
if (context.mounted) {
showSnackBar('contactMethodVerificationSent'.tr());
}
@@ -53,7 +53,7 @@ class ContactMethodSheet extends HookConsumerWidget {
try {
showLoadingModal(context);
final client = ref.read(apiClientProvider);
await client.post('/accounts/me/contacts/${contact.id}/primary');
await client.post('/id/accounts/me/contacts/${contact.id}/primary');
if (context.mounted) Navigator.pop(context, true);
} catch (err) {
showErrorAlert(err);