Files
shop-server/client/src/shared/lib/get-api-error-message.ts
T
Kirill 68bbbf8895 refactor(auth): extract AuthPasswordForm and AuthCodeForm to features
- Create auth-password feature with login/register form
- Create auth-code feature with email+code verification form
- Extract getApiErrorMessage to shared lib
- Simplify AuthPage to pure UI composer with tabs
- Update tests for new component structure
- All 40 tests passing
2026-05-22 14:36:19 +05:00

9 lines
382 B
TypeScript

export function getApiErrorMessage(err: unknown): string | null {
if (!err || typeof err !== 'object') return null
const anyErr = err as Record<string, unknown>
const response = anyErr.response as Record<string, unknown> | undefined
const data = response?.data as Record<string, unknown> | undefined
const msg = data?.error
return typeof msg === 'string' ? msg : null
}