register method
Implementation
Future<UserModel> register({
required String email,
required String password,
}) async {
final response = await http.post(
Uri.parse('$baseUrl/register'),
headers: {'Content-Type': 'application/json'},
body: jsonEncode({'email': email, 'password': password}),
);
if (response.statusCode == 201) {
return UserModel.fromJson(jsonDecode(response.body));
} else {
throw Exception('Registration failed');
}
}