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;
}
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 bodyData = {'loginId': loginId};
if (companyCode != null && companyCode.isNotEmpty) {
@@ -907,10 +910,16 @@ class AuthProxyService {
if (response.statusCode == 200) {
final data = jsonDecode(response.body);
return {'available': data['available'] ?? false, 'message': data['message']};
return {
'available': data['available'] ?? false,
'message': data['message'],
};
} else {
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,
decoration: InputDecoration(
labelText: _loginIdLabel ?? tr(
'ui.userfront.login.field.login_id',
),
labelText:
_loginIdLabel ??
tr(
'ui.userfront.login.field.login_id',
),
border: const OutlineInputBorder(),
prefixIcon: const Icon(
Icons.person_outline,

View File

@@ -1446,42 +1446,68 @@ class _SignupScreenState extends State<SignupScreen> {
border: const OutlineInputBorder(),
errorText: _loginIdError,
suffixIcon: TextButton(
onPressed: _isLoading ? null : () async {
final loginId = _loginIdController.text.trim();
if (loginId.isEmpty) {
setState(() => _loginIdError = 'ID를 입력해주세요.');
return;
}
setState(() {
_isLoading = true;
_loginIdError = null;
_loginIdSuccess = null;
});
try {
final result = await AuthProxyService.checkLoginIDAvailability(loginId, companyCode: _affiliationType == 'AFFILIATE' ? _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);
}
},
onPressed: _isLoading
? null
: () async {
final loginId = _loginIdController.text
.trim();
if (loginId.isEmpty) {
setState(
() => _loginIdError = 'ID를 입력해주세요.',
);
return;
}
setState(() {
_isLoading = true;
_loginIdError = null;
_loginIdSuccess = null;
});
try {
final result =
await AuthProxyService.checkLoginIDAvailability(
loginId,
companyCode:
_affiliationType ==
'AFFILIATE'
? _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('중복 확인'),
),
),
),
if (_loginIdSuccess != null)
Padding(
padding: const EdgeInsets.only(top: 8.0, left: 12.0),
padding: const EdgeInsets.only(
top: 8.0,
left: 12.0,
),
child: Text(
_loginIdSuccess!,
style: const TextStyle(color: Colors.green, fontSize: 12),
style: const TextStyle(
color: Colors.green,
fontSize: 12,
),
),
),
],