Skip to content

Commit 1a4b766

Browse files
committed
Added new project structure and started with query building. Needs tidy up.
1 parent 89722a5 commit 1a4b766

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

lib/objects/parse_user.dart

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,26 +70,44 @@ class User implements ParseBaseObject {
7070
objectData = {}..addAll(objectData)..addAll(objectInitialData);
7171
}
7272
_resetObjectId();
73-
print(objectData);
74-
final response = this.client.post("${client.data.serverUrl}$path",
73+
74+
Map<String, dynamic> bodyData = {};
75+
bodyData["email"] = userData.username;
76+
bodyData["password"] = userData.password;
77+
bodyData["username"] = userData.username;
78+
79+
Uri tempUri = Uri.parse(client.data.serverUrl);
80+
81+
Uri url = Uri(
82+
scheme: tempUri.scheme,
83+
host: tempUri.host,
84+
path: "${tempUri.path}$path"
85+
);
86+
87+
final response = this.client.post(url,
7588
headers: {
7689
'X-Parse-Revocable-Session': "1",
7790
},
78-
body: JsonEncoder().convert(objectData));
91+
body: JsonEncoder().convert(bodyData));
92+
7993
return response.then((value) {
8094
_handleResponse(value.body);
8195
return objectData;
8296
});
8397
}
8498

8599
Future<Map<String, dynamic>> login() async {
100+
Uri tempUri = Uri.parse(client.data.serverUrl);
86101

87-
Uri url = new Uri(
88-
path: "${client.data.serverUrl}/parse/login",
102+
Uri url = Uri(
103+
scheme: tempUri.scheme,
104+
host: tempUri.host,
105+
path: "${tempUri.path}/login",
89106
queryParameters: {
90107
"username": userData.username,
91108
"password": userData.password
92-
});
109+
}
110+
);
93111

94112
final response = this.client.post(url, headers: {
95113
'X-Parse-Revocable-Session': "1",
@@ -102,7 +120,7 @@ class User implements ParseBaseObject {
102120

103121
Future<Map<String, dynamic>> verificationEmailRequest() async {
104122
final response = this.client.post(
105-
"${client.data.serverUrl}/parse/verificationEmailRequest",
123+
"${client.data.serverUrl}/verificationEmailRequest",
106124
body: JsonEncoder().convert({"email": userData.emailAddress}));
107125
return response.then((value) {
108126
return _handleResponse(value.body);
@@ -111,7 +129,7 @@ class User implements ParseBaseObject {
111129

112130
Future<Map<String, dynamic>> requestPasswordReset() async {
113131
final response = this.client.post(
114-
"${client.data.serverUrl}/parse/requestPasswordReset",
132+
"${client.data.serverUrl}/requestPasswordReset",
115133
body: JsonEncoder().convert({"email": userData.emailAddress}));
116134
return response.then((value) {
117135
return _handleResponse(value.body);

0 commit comments

Comments
 (0)