Skip to content

Commit a480e7a

Browse files
committed
fix: handle SlashtagsAuthClient.authz "channel closed" error correctly
1 parent a1fed45 commit a480e7a

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

src/screens/Widgets/SlashAuthModal.tsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,22 @@ const _SlashAuthModal = (): ReactElement => {
124124
setIsLoading(true);
125125

126126
const client = new Client(slashtag);
127-
const response = await client.authz(_url).catch((e: Error) => {
128-
if (e.message === 'channel closed') {
129-
closeBottomSheet('slashauthModal');
130-
showErrorNotification({
131-
title: t('signin_to_error_header'),
132-
message: t('signin_to_error_text'),
133-
});
134-
}
135-
});
127+
let response;
128+
129+
try {
130+
response = await client.authz(_url);
131+
} catch (e) {
132+
showErrorNotification({
133+
title: t('signin_to_error_header'),
134+
message:
135+
e.message === 'channel closed'
136+
? t('signin_to_error_text')
137+
: e.message,
138+
});
139+
setIsLoading(false);
140+
closeBottomSheet('slashauthModal');
141+
return;
142+
}
136143

137144
if (response?.status === 'ok') {
138145
showSuccessNotification({

0 commit comments

Comments
 (0)