mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-20 21:00:41 +00:00
feat: add registration invite code handling and improve error translations
- Updated AuthViews component to conditionally show invite code field based on registrationInviteRequired prop. - Enhanced error handling in auth API functions to use translateServerError for better user feedback. - Added new translations for various server error messages in English, Spanish, Russian, Chinese (Simplified and Traditional). - Modified demo initial bootstrap state to include registrationInviteRequired flag. - Updated types to include registrationInviteRequired in WebBootstrapResponse.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { t } from '../i18n';
|
||||
import { t, translateServerError } from '../i18n';
|
||||
import type { SessionState, TokenError } from '../types';
|
||||
|
||||
export type AuthedFetch = (input: string, init?: RequestInit) => Promise<Response>;
|
||||
@@ -46,7 +46,7 @@ export function parseContentDispositionFileName(response: Response, fallback: st
|
||||
|
||||
export async function parseErrorMessage(resp: Response, fallback: string): Promise<string> {
|
||||
const body = await parseJson<TokenError>(resp);
|
||||
return body?.error_description || body?.error || fallback;
|
||||
return translateServerError(body?.error_description || body?.error, fallback);
|
||||
}
|
||||
|
||||
export function createApiError(message: string, status?: number): Error & { status?: number } {
|
||||
|
||||
Reference in New Issue
Block a user