forked from eatvio/eatvio_app
Added a name field to pass server validation
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
class UserRegistrationSheet {
|
||||
String name;
|
||||
String firstName;
|
||||
String lastName;
|
||||
String email;
|
||||
@@ -30,6 +31,7 @@ class UserRegistrationSheet {
|
||||
String additionalInfo = '';
|
||||
|
||||
UserRegistrationSheet({
|
||||
required this.name,
|
||||
required this.firstName,
|
||||
required this.lastName,
|
||||
required this.email,
|
||||
@@ -60,6 +62,7 @@ class UserRegistrationSheet {
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'name': name,
|
||||
'first_name': firstName,
|
||||
'last_name': lastName,
|
||||
'email': email,
|
||||
@@ -88,15 +91,4 @@ class UserRegistrationSheet {
|
||||
'additional_info': additionalInfo,
|
||||
};
|
||||
}
|
||||
|
||||
Future<void> sendJson(Uri url) async {
|
||||
final response = await http.post(
|
||||
url,
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: jsonEncode(toJson()),
|
||||
);
|
||||
if (response.statusCode != 200) {
|
||||
throw Exception('Failed to send data');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user