Skip to content

Commit b372027

Browse files
committed
test: fix failing e2e test due to improper error message parsing
1 parent 9ed8515 commit b372027

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/ui/services/auth.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ export const getAxiosConfig = (): AxiosConfig => {
4545
* Processes authentication errors and returns a user-friendly error message
4646
*/
4747
export const processAuthError = (error: AxiosError<any>, jwtAuthEnabled = false): string => {
48-
let errorMessage = `Failed to authorize user: ${error.response?.data?.trim() ?? ''}. `;
48+
const errorMessage = (error.response?.data as any)?.message ?? 'Unknown error';
49+
let msg = `Failed to authorize user: ${errorMessage.trim()}. `;
4950
if (jwtAuthEnabled && !localStorage.getItem('ui_jwt_token')) {
50-
errorMessage +=
51-
'Set your JWT token in the settings page or disable JWT auth in your app configuration.';
51+
msg += 'Set your JWT token in the settings page or disable JWT auth in your app configuration.';
5252
} else {
53-
errorMessage += 'Check your JWT token or disable JWT auth in your app configuration.';
53+
msg += 'Check your JWT token or disable JWT auth in your app configuration.';
5454
}
55-
return errorMessage;
55+
return msg;
5656
};

0 commit comments

Comments
 (0)