From fef1621d3ef781e29cc034cac7c3f57cbc7976b6 Mon Sep 17 00:00:00 2001 From: Felix Date: Tue, 16 Jul 2019 11:42:34 +0100 Subject: [PATCH] Logout works all that needs doing now is 'save login' --- ios/Podfile.lock | 4 ++-- ios/Runner.xcodeproj/project.pbxproj | 2 +- lib/common/apifunctions/request_logout_api.dart | 10 ++++++++-- lib/common/apifunctions/submit_receipt_api.dart | 8 ++++---- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 81f2036..f5bffe1 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -6,13 +6,13 @@ PODS: - Flutter DEPENDENCIES: - - Flutter (from `.symlinks/flutter/ios-profile`) + - Flutter (from `.symlinks/flutter/ios`) - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - url_launcher (from `.symlinks/plugins/url_launcher/ios`) EXTERNAL SOURCES: Flutter: - :path: ".symlinks/flutter/ios-profile" + :path: ".symlinks/flutter/ios" shared_preferences: :path: ".symlinks/plugins/shared_preferences/ios" url_launcher: diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index dff0209..a83a4d3 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -281,7 +281,7 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${PODS_ROOT}/../.symlinks/flutter/ios-profile/Flutter.framework", + "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( diff --git a/lib/common/apifunctions/request_logout_api.dart b/lib/common/apifunctions/request_logout_api.dart index 324660f..17a63a2 100644 --- a/lib/common/apifunctions/request_logout_api.dart +++ b/lib/common/apifunctions/request_logout_api.dart @@ -1,5 +1,5 @@ -import 'dart:io'; import 'dart:async'; +import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; @@ -16,12 +16,18 @@ Future requestLogoutAPI(BuildContext context) async { token = result; }); + Map body = { + "Token":token, + }; + final response = await http.post( url, - headers: {HttpHeaders.authorizationHeader: "Token $token"}, + body: json.encode(body), ); if (response.statusCode == 200) { + debugPrint("Logout successful: " + response.body); + saveLogout(); return null; } else { diff --git a/lib/common/apifunctions/submit_receipt_api.dart b/lib/common/apifunctions/submit_receipt_api.dart index ed74f92..7c68ca3 100644 --- a/lib/common/apifunctions/submit_receipt_api.dart +++ b/lib/common/apifunctions/submit_receipt_api.dart @@ -62,10 +62,10 @@ Future submitReceiptAPI( print(responseJson[0]); showDialogSingleButton( - context, - responseJson[0] == "" ? responseJson[0] : "Upload Successful", - "Transaction successfully submitted to server", - "OK" + context, + responseJson[0] == "" ? responseJson[0] : "Upload Successful", + "Transaction successfully submitted to server", + "OK" ); return LoginModel.fromJson(responseJson); } else {