temporary update

This commit is contained in:
2024-09-08 18:16:51 +09:00
parent 2c0bb06e74
commit e37c4ceebd
32 changed files with 1235 additions and 1189 deletions

View File

@ -87,8 +87,7 @@ class AuthService {
return changePassword;
}
static Future<Map<String, dynamic>> login(
String email, String password) async {
static Future<Map<String, dynamic>> login(String email, String password) async {
//print("------- in logged email $email pwd $password ###### --------");
Map<String, dynamic> cats = {};
String serverUrl = ConstValues.currentServer();
@ -116,17 +115,12 @@ class AuthService {
var errorBody = json.decode(utf8.decode(response.bodyBytes));
errorMessage = errorBody['non_field_errors']?[0] ?? 'パスワードが正しくありません。';
}
Get.snackbar(
"エラー",
errorMessage,
backgroundColor: Colors.red,
colorText: Colors.white,
snackPosition: SnackPosition.TOP,
duration: const Duration(seconds: 3),
);
cats = {};
throw Exception(errorMessage);
}
} catch( e ){
print('Error in login: $e');
throw e; // エラーを上位に伝播させる
/*
print('Error in login: $e');
Get.snackbar("通信エラーがおきました", "サーバーと通信できませんでした",
backgroundColor: Colors.red,
@ -142,7 +136,8 @@ class AuthService {
duration: const Duration(seconds: 3),
//backgroundColor: Colors.yellow,
);
cats = {};
*/
//cats = {};
}
return cats;
}
@ -171,7 +166,7 @@ class AuthService {
Map<String, dynamic> cats = {};
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/register/';
debugPrint('++++++++$url');
//debugPrint('++++++++$url');
final http.Response response = await http.post(
Uri.parse(url),
headers: <String, String>{