Removed fallback strings.
This commit is contained in:
1 parent
13b8bb6656
commit
caab2c36b5
1 file changed
+9
-9
@@ -46,7 +46,7 @@ const useNotifications = () => {
|
|||||||
payload.webhookUrl = config.webhook;
|
payload.webhookUrl = config.webhook;
|
||||||
if (typeof payload.webhookUrl === 'undefined' || payload.webhookUrl === '') {
|
if (typeof payload.webhookUrl === 'undefined' || payload.webhookUrl === '') {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
errorMessage = t('notifications.slack.webhookRequired', 'Please enter a Slack webhook URL first.');
|
errorMessage = t('notifications.slack.webhookRequired');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ const useNotifications = () => {
|
|||||||
payload.webhookUrl = config.webhook;
|
payload.webhookUrl = config.webhook;
|
||||||
if (typeof payload.webhookUrl === 'undefined' || payload.webhookUrl === '') {
|
if (typeof payload.webhookUrl === 'undefined' || payload.webhookUrl === '') {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
errorMessage = t('notifications.discord.webhookRequired', 'Please enter a Discord webhook URL first.');
|
errorMessage = t('notifications.discord.webhookRequired');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ const useNotifications = () => {
|
|||||||
if (typeof payload.botToken === 'undefined' || payload.botToken === '' ||
|
if (typeof payload.botToken === 'undefined' || payload.botToken === '' ||
|
||||||
typeof payload.chatId === 'undefined' || payload.chatId === '') {
|
typeof payload.chatId === 'undefined' || payload.chatId === '') {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
errorMessage = t('notifications.telegram.fieldsRequired', 'Please enter both Telegram bot token and chat ID.');
|
errorMessage = t('notifications.telegram.fieldsRequired');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -73,13 +73,13 @@ const useNotifications = () => {
|
|||||||
payload.platform = NOTIFICATION_TYPES.SLACK;
|
payload.platform = NOTIFICATION_TYPES.SLACK;
|
||||||
if (typeof payload.webhookUrl === 'undefined' || payload.webhookUrl === '') {
|
if (typeof payload.webhookUrl === 'undefined' || payload.webhookUrl === '') {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
errorMessage = t('notifications.webhook.urlRequired', 'Please enter a webhook URL first.');
|
errorMessage = t('notifications.webhook.urlRequired');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
isValid = false;
|
isValid = false;
|
||||||
errorMessage = t('notifications.unsupportedType', 'This notification type cannot be tested.');
|
errorMessage = t('notifications.unsupportedType');
|
||||||
}
|
}
|
||||||
|
|
||||||
// If validation fails, show error and return
|
// If validation fails, show error and return
|
||||||
@@ -93,13 +93,13 @@ const useNotifications = () => {
|
|||||||
const response = await networkService.axiosInstance.post('/notifications/test-webhook', payload);
|
const response = await networkService.axiosInstance.post('/notifications/test-webhook', payload);
|
||||||
|
|
||||||
if (response.data.success === true) {
|
if (response.data.success === true) {
|
||||||
toast.success(t('notifications.testSuccess', 'Test notification sent successfully!'));
|
toast.success(t('notifications.testSuccess'));
|
||||||
} else {
|
} else {
|
||||||
throw new Error(response.data.msg || t('notifications.testFailed', 'Failed to send test notification'));
|
throw new Error(response.data.msg || t('notifications.testFailed'));
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const errorMsg = error.response?.data?.msg || error.message || t('notifications.networkError', 'Network error occurred');
|
const errorMsg = error.response?.data?.msg || error.message || t('notifications.networkError');
|
||||||
toast.error(`${t('notifications.testFailed', 'Failed to send test notification')}: ${errorMsg}`);
|
toast.error(`${t('notifications.testFailed')}: ${errorMsg}`);
|
||||||
setError(errorMsg);
|
setError(errorMsg);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|||||||
Reference in new issue
Block a user