fix: localize API error messages
Build and publish Docker images / Build and publish images (push) Successful in 2m35s

This commit is contained in:
2026-09-14 14:40:49 +08:00
parent ac612b92cf
commit ca2a3c2dee
10 changed files with 249 additions and 63 deletions
@@ -1,4 +1,5 @@
import { emitter } from 'shared/helpers/mitt';
import { parseAPIErrorResponse } from 'dashboard/store/utils/api';
import analyticsHelper from 'dashboard/helper/AnalyticsHelper/index';
/**
@@ -20,5 +21,12 @@ export const useTrack = (...args) => {
* @param {Object|null} action - Optional callback function or object to execute.
*/
export const useAlert = (message, action = null) => {
emitter.emit('newToastMessage', { message, action });
const normalizedMessage =
message === null || message === undefined || message === ''
? message
: parseAPIErrorResponse(message);
emitter.emit('newToastMessage', {
message: normalizedMessage,
action,
});
};