👽 Update API to microservices
♻️ Refactor router pushes
This commit is contained in:
@@ -72,7 +72,7 @@ class PostItem extends HookConsumerWidget {
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
context.push('/publishers/${item.publisher.name}');
|
||||
context.pushNamed('publisherProfile', pathParameters: {'name': item.publisher.name});
|
||||
},
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
@@ -254,7 +254,7 @@ class PostItem extends HookConsumerWidget {
|
||||
GestureDetector(
|
||||
child: ProfilePictureWidget(file: item.publisher.picture),
|
||||
onTap: () {
|
||||
context.push('/publishers/${item.publisher.name}');
|
||||
context.pushNamed('publisherProfile', pathParameters: {'name': item.publisher.name});
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
@@ -427,7 +427,7 @@ class PostItem extends HookConsumerWidget {
|
||||
),
|
||||
onTap: () {
|
||||
if (isOpenable) {
|
||||
context.push('/posts/${item.id}');
|
||||
context.pushNamed('postDetail', pathParameters: {'id': item.id});
|
||||
}
|
||||
},
|
||||
),
|
||||
@@ -496,7 +496,7 @@ class PostItem extends HookConsumerWidget {
|
||||
title: 'edit'.tr(),
|
||||
image: MenuImage.icon(Symbols.edit),
|
||||
callback: () {
|
||||
context.push('/posts/${item.id}/edit').then((value) {
|
||||
context.pushNamed('postEdit', pathParameters: {'id': item.id}).then((value) {
|
||||
if (value != null) {
|
||||
onRefresh?.call();
|
||||
}
|
||||
@@ -515,7 +515,7 @@ class PostItem extends HookConsumerWidget {
|
||||
if (confirm) {
|
||||
final client = ref.watch(apiClientProvider);
|
||||
client
|
||||
.delete('/posts/${item.id}')
|
||||
.delete('/sphere/posts/${item.id}')
|
||||
.catchError((err) {
|
||||
showErrorAlert(err);
|
||||
return err;
|
||||
@@ -541,8 +541,8 @@ class PostItem extends HookConsumerWidget {
|
||||
title: 'reply'.tr(),
|
||||
image: MenuImage.icon(Symbols.reply),
|
||||
callback: () {
|
||||
context.push(
|
||||
'/posts/compose',
|
||||
context.pushNamed(
|
||||
'postCompose',
|
||||
extra: PostComposeInitialState(replyingTo: item),
|
||||
);
|
||||
},
|
||||
@@ -551,8 +551,8 @@ class PostItem extends HookConsumerWidget {
|
||||
title: 'forward'.tr(),
|
||||
image: MenuImage.icon(Symbols.forward),
|
||||
callback: () {
|
||||
context.push(
|
||||
'/posts/compose',
|
||||
context.pushNamed(
|
||||
'postCompose',
|
||||
extra: PostComposeInitialState(forwardingTo: item),
|
||||
);
|
||||
},
|
||||
@@ -732,7 +732,7 @@ Widget _buildReferencePost(BuildContext context, SnPost item) {
|
||||
),
|
||||
],
|
||||
),
|
||||
).gestures(onTap: () => context.push('/posts/${referencePost.id}'));
|
||||
).gestures(onTap: () => context.pushNamed('postDetail', pathParameters: {'id': referencePost.id}));
|
||||
}
|
||||
|
||||
class PostReactionList extends HookConsumerWidget {
|
||||
|
@@ -45,7 +45,7 @@ class PostItemCreator extends HookConsumerWidget {
|
||||
title: 'edit'.tr(),
|
||||
image: MenuImage.icon(Symbols.edit),
|
||||
callback: () {
|
||||
context.push('/posts/${item.id}/edit').then((value) {
|
||||
context.pushNamed('postEdit', pathParameters: {'id': item.id}).then((value) {
|
||||
if (value != null) {
|
||||
onRefresh?.call();
|
||||
}
|
||||
@@ -61,7 +61,7 @@ class PostItemCreator extends HookConsumerWidget {
|
||||
if (confirm) {
|
||||
final client = ref.watch(apiClientProvider);
|
||||
client
|
||||
.delete('/posts/${item.id}')
|
||||
.delete('/sphere/posts/${item.id}')
|
||||
.catchError((err) {
|
||||
showErrorAlert(err);
|
||||
return err;
|
||||
@@ -80,7 +80,7 @@ class PostItemCreator extends HookConsumerWidget {
|
||||
image: MenuImage.icon(Symbols.link),
|
||||
callback: () {
|
||||
// Copy post link to clipboard
|
||||
context.push('/posts/${item.id}');
|
||||
context.pushNamed('postDetail', pathParameters: {'id': item.id});
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -94,7 +94,7 @@ class PostItemCreator extends HookConsumerWidget {
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
onTap: () {
|
||||
if (isOpenable) {
|
||||
context.push('/posts/${item.id}');
|
||||
context.pushNamed('postDetail', pathParameters: {'id': item.id});
|
||||
}
|
||||
},
|
||||
child: Padding(
|
||||
|
@@ -30,7 +30,10 @@ class PostListNotifier extends _$PostListNotifier
|
||||
if (pubName != null) 'pub': pubName,
|
||||
};
|
||||
|
||||
final response = await client.get('/posts', queryParameters: queryParams);
|
||||
final response = await client.get(
|
||||
'/sphere/posts',
|
||||
queryParameters: queryParams,
|
||||
);
|
||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
||||
final List<dynamic> data = response.data;
|
||||
final posts = data.map((json) => SnPost.fromJson(json)).toList();
|
||||
|
@@ -6,7 +6,7 @@ part of 'post_list.dart';
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$postListNotifierHash() => r'a2a273cbf96393a84a66bd6ae8e88058704f3195';
|
||||
String _$postListNotifierHash() => r'2e4fb36123d3f97ac1edf9945043251d4eb519a2';
|
||||
|
||||
/// Copied from Dart SDK
|
||||
class _SystemHash {
|
||||
|
@@ -43,8 +43,7 @@ class PublisherModal extends HookConsumerWidget {
|
||||
const Gap(12),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
context.push('/creators/publishers/new')
|
||||
.then((value) {
|
||||
context.pushNamed('creatorNew').then((value) {
|
||||
if (value != null) {
|
||||
ref.invalidate(
|
||||
publishersManagedProvider,
|
||||
|
Reference in New Issue
Block a user