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,9 +1470,11 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
), ),
controller: _passwordLoginIdController, controller: _passwordLoginIdController,
decoration: InputDecoration( decoration: InputDecoration(
labelText: _loginIdLabel ?? tr( labelText:
'ui.userfront.login.field.login_id', _loginIdLabel ??
), tr(
'ui.userfront.login.field.login_id',
),
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
prefixIcon: const Icon( prefixIcon: const Icon(
Icons.person_outline, Icons.person_outline,

View File

@@ -1446,42 +1446,68 @@ 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
if (loginId.isEmpty) { : () async {
setState(() => _loginIdError = 'ID를 입력해주세요.'); final loginId = _loginIdController.text
return; .trim();
} if (loginId.isEmpty) {
setState(() { setState(
_isLoading = true; () => _loginIdError = 'ID를 입력해주세요.',
_loginIdError = null; );
_loginIdSuccess = null; return;
}); }
try { setState(() {
final result = await AuthProxyService.checkLoginIDAvailability(loginId, companyCode: _affiliationType == 'AFFILIATE' ? _companyCode : null); _isLoading = true;
setState(() { _loginIdError = null;
if (result['available'] == true) { _loginIdSuccess = null;
_loginIdSuccess = '사용 가능한 ID입니다.'; });
} else { try {
_loginIdError = result['message'] ?? '사용할 수 없는 ID입니다.'; final result =
} await AuthProxyService.checkLoginIDAvailability(
}); loginId,
} catch (e) { companyCode:
setState(() => _loginIdError = e.toString().replaceAll('Exception: ', '')); _affiliationType ==
} finally { 'AFFILIATE'
if (mounted) setState(() => _isLoading = false); ? _companyCode
} : null,
}, );
setState(() {
if (result['available'] == true) {
_loginIdSuccess = '사용 가능한 ID입니다.';
} else {
_loginIdError =
result['message'] ??
'사용할 수 없는 ID입니다.';
}
});
} catch (e) {
setState(
() => _loginIdError = e
.toString()
.replaceAll('Exception: ', ''),
);
} finally {
if (mounted)
setState(() => _isLoading = false);
}
},
child: const Text('중복 확인'), child: const Text('중복 확인'),
), ),
), ),
), ),
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,
),
), ),
), ),
], ],