fix: Route back to room list after leaving a chat
This commit is contained in:
parent
29a2dc83c0
commit
7d798c5770
1 changed files with 9 additions and 8 deletions
|
|
@ -56,6 +56,7 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
||||||
onSelected: (choice) async {
|
onSelected: (choice) async {
|
||||||
switch (choice) {
|
switch (choice) {
|
||||||
case ChatPopupMenuActions.leave:
|
case ChatPopupMenuActions.leave:
|
||||||
|
final router = GoRouter.of(context);
|
||||||
final confirmed = await showOkCancelAlertDialog(
|
final confirmed = await showOkCancelAlertDialog(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).areYouSure,
|
title: L10n.of(context).areYouSure,
|
||||||
|
|
@ -64,15 +65,15 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
isDestructive: true,
|
isDestructive: true,
|
||||||
);
|
);
|
||||||
if (confirmed == OkCancelResult.ok) {
|
if (confirmed != OkCancelResult.ok) return;
|
||||||
final success = await showFutureLoadingDialog(
|
final result = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => widget.room.leave(),
|
future: () => widget.room.leave(),
|
||||||
);
|
);
|
||||||
if (success.error == null) {
|
if (result.error == null) {
|
||||||
context.go('/rooms');
|
router.go('/rooms');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ChatPopupMenuActions.mute:
|
case ChatPopupMenuActions.mute:
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue