1
0
forked from baron/baron-sso

style(userfront): apply dart format

This commit is contained in:
2026-03-27 18:10:32 +09:00
parent 6192220ec1
commit f8d10c90b8
3 changed files with 71 additions and 34 deletions

View File

@@ -893,7 +893,10 @@ class AuthProxyService {
return false; return false;
} }
static Future<Map<String, dynamic>> checkLoginIDAvailability(String loginId, {String? companyCode}) async { static Future<Map<String, dynamic>> checkLoginIDAvailability(
String loginId, {
String? companyCode,
}) async {
final url = Uri.parse('$_baseUrl/api/v1/auth/signup/check-login-id'); final url = Uri.parse('$_baseUrl/api/v1/auth/signup/check-login-id');
final bodyData = {'loginId': loginId}; final bodyData = {'loginId': loginId};
if (companyCode != null && companyCode.isNotEmpty) { if (companyCode != null && companyCode.isNotEmpty) {
@@ -907,10 +910,16 @@ class AuthProxyService {
if (response.statusCode == 200) { if (response.statusCode == 200) {
final data = jsonDecode(response.body); final data = jsonDecode(response.body);
return {'available': data['available'] ?? false, 'message': data['message']}; return {
'available': data['available'] ?? false,
'message': data['message'],
};
} else { } else {
final data = jsonDecode(response.body); final data = jsonDecode(response.body);
return {'available': false, 'message': data['message'] ?? 'Failed to check ID'}; return {
'available': false,
'message': data['message'] ?? 'Failed to check ID',
};
} }
} }

View File

@@ -1470,7 +1470,9 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
), ),
controller: _passwordLoginIdController, controller: _passwordLoginIdController,
decoration: InputDecoration( decoration: InputDecoration(
labelText: _loginIdLabel ?? tr( labelText:
_loginIdLabel ??
tr(
'ui.userfront.login.field.login_id', 'ui.userfront.login.field.login_id',
), ),
border: const OutlineInputBorder(), border: const OutlineInputBorder(),

View File

@@ -1446,10 +1446,15 @@ class _SignupScreenState extends State<SignupScreen> {
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
errorText: _loginIdError, errorText: _loginIdError,
suffixIcon: TextButton( suffixIcon: TextButton(
onPressed: _isLoading ? null : () async { onPressed: _isLoading
final loginId = _loginIdController.text.trim(); ? null
: () async {
final loginId = _loginIdController.text
.trim();
if (loginId.isEmpty) { if (loginId.isEmpty) {
setState(() => _loginIdError = 'ID를 입력해주세요.'); setState(
() => _loginIdError = 'ID를 입력해주세요.',
);
return; return;
} }
setState(() { setState(() {
@@ -1458,18 +1463,33 @@ class _SignupScreenState extends State<SignupScreen> {
_loginIdSuccess = null; _loginIdSuccess = null;
}); });
try { try {
final result = await AuthProxyService.checkLoginIDAvailability(loginId, companyCode: _affiliationType == 'AFFILIATE' ? _companyCode : null); final result =
await AuthProxyService.checkLoginIDAvailability(
loginId,
companyCode:
_affiliationType ==
'AFFILIATE'
? _companyCode
: null,
);
setState(() { setState(() {
if (result['available'] == true) { if (result['available'] == true) {
_loginIdSuccess = '사용 가능한 ID입니다.'; _loginIdSuccess = '사용 가능한 ID입니다.';
} else { } else {
_loginIdError = result['message'] ?? '사용할 수 없는 ID입니다.'; _loginIdError =
result['message'] ??
'사용할 수 없는 ID입니다.';
} }
}); });
} catch (e) { } catch (e) {
setState(() => _loginIdError = e.toString().replaceAll('Exception: ', '')); setState(
() => _loginIdError = e
.toString()
.replaceAll('Exception: ', ''),
);
} finally { } finally {
if (mounted) setState(() => _isLoading = false); if (mounted)
setState(() => _isLoading = false);
} }
}, },
child: const Text('중복 확인'), child: const Text('중복 확인'),
@@ -1478,10 +1498,16 @@ class _SignupScreenState extends State<SignupScreen> {
), ),
if (_loginIdSuccess != null) if (_loginIdSuccess != null)
Padding( Padding(
padding: const EdgeInsets.only(top: 8.0, left: 12.0), padding: const EdgeInsets.only(
top: 8.0,
left: 12.0,
),
child: Text( child: Text(
_loginIdSuccess!, _loginIdSuccess!,
style: const TextStyle(color: Colors.green, fontSize: 12), style: const TextStyle(
color: Colors.green,
fontSize: 12,
),
), ),
), ),
], ],