|
@@ -11,9 +11,12 @@ export interface UseActionParams {
|
|
|
export type LoginErrorKey = 'loginError' | null;
|
|
export type LoginErrorKey = 'loginError' | null;
|
|
|
|
|
|
|
|
function getErrorMessage(err: unknown): { message: string | null; errorKey: LoginErrorKey } {
|
|
function getErrorMessage(err: unknown): { message: string | null; errorKey: LoginErrorKey } {
|
|
|
- const anyErr = err as { name?: string; info?: { errorMessage?: string }; response?: { data?: { errorMessage?: string } } };
|
|
|
|
|
- const backendMsg =
|
|
|
|
|
- anyErr?.info?.errorMessage ?? anyErr?.response?.data?.errorMessage ?? null;
|
|
|
|
|
|
|
+ const anyErr = err as {
|
|
|
|
|
+ name?: string;
|
|
|
|
|
+ info?: { errorMessage?: string };
|
|
|
|
|
+ response?: { data?: { errorMessage?: string } };
|
|
|
|
|
+ };
|
|
|
|
|
+ const backendMsg = anyErr?.info?.errorMessage ?? anyErr?.response?.data?.errorMessage ?? null;
|
|
|
if (backendMsg && typeof backendMsg === 'string') {
|
|
if (backendMsg && typeof backendMsg === 'string') {
|
|
|
return { message: backendMsg, errorKey: null };
|
|
return { message: backendMsg, errorKey: null };
|
|
|
}
|
|
}
|