Skip to content

Commit 8cef05d

Browse files
author
Christoph Bayer
committed
Fix ParseUser.logout method.
1 parent 3f18bc7 commit 8cef05d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/src/objects/parse_user.dart

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,26 +203,25 @@ class ParseUser extends ParseObject implements ParseCloneable {
203203
/// Sends a request to delete the sessions token from the
204204
/// server. Will also delete the local user data unless
205205
/// deleteLocalUserData is false.
206-
logout({bool deleteLocalUserData = true}) async {
207-
if (deleteLocalUserData) {
206+
Future<ParseResponse> logout({bool deleteLocalUserData = true}) async {
207+
final String sessionId = _client.data.sessionId;
208+
209+
if (deleteLocalUserData == true) {
208210
_client.data.sessionId = null;
209211
unpin(key: keyParseStoreUser);
210212
setObjectData(null);
211213
}
212214

213215
try {
214-
if (username == null) return null;
215-
216216
Uri tempUri = Uri.parse(_client.data.serverUrl);
217217

218218
Uri url = Uri(
219219
scheme: tempUri.scheme,
220220
host: tempUri.host,
221221
path: "${tempUri.path}$keyEndPointLogout");
222222

223-
final response = await _client.post(
224-
url,
225-
);
223+
final response =
224+
await _client.post(url, headers: {keyHeaderSessionToken: sessionId});
226225

227226
return _handleResponse(
228227
this, response, ParseApiRQ.logout, _debug, className);

0 commit comments

Comments
 (0)