notification if telegram server is not reachable

main
alex 2023-11-04 22:03:59 +01:00
parent a8fa795be4
commit 0ff022d42e
3 changed files with 22 additions and 13 deletions

View File

@ -440,6 +440,9 @@
"verificationPopover": { "verificationPopover": {
"title": "Verification", "title": "Verification",
"description": "Add the bot on your telegram account and send the command {{command}} to the bot" "description": "Add the bot on your telegram account and send the command {{command}} to the bot"
},
"connectionFailedPopover": {
"title": "Failed to get telegram verify status"
} }
} }
}, },

View File

@ -299,7 +299,8 @@ export default function UserProfile({ userSession, setUserSession }) {
{}, {},
myFetchContentType.JSON, myFetchContentType.JSON,
Constants.TELEGRAM_BOT_MANAGER_ADDRESS Constants.TELEGRAM_BOT_MANAGER_ADDRESS
).then((data) => { )
.then((data) => {
// manual check verify status by clicking reload icon // manual check verify status by clicking reload icon
if (!updateOnlyOnVerified) { if (!updateOnlyOnVerified) {
setTelegramNotificationSubscribedStatus(data.Status); setTelegramNotificationSubscribedStatus(data.Status);
@ -311,7 +312,13 @@ export default function UserProfile({ userSession, setUserSession }) {
clearInterval(statusInterval.current); clearInterval(statusInterval.current);
telegramVerifyCodeRequestTime.current = null; telegramVerifyCodeRequestTime.current = null;
} }
}); })
.catch(() =>
notificationApi["error"]({
message: t("userProfile.telegram.connectionFailedPopover.title"),
description: t("common.contactAdmin"),
})
);
const TelegramNotificationSubscribedStatusItem = () => { const TelegramNotificationSubscribedStatusItem = () => {
// check verified status // check verified status

View File

@ -1449,7 +1449,6 @@ export function myFetch(
return response.text(); return response.text();
}) })
.catch((error) => { .catch((error) => {
console.error("myFetch error:", error);
throw error; throw error;
}); });
} }