Logout works

all that needs doing now is 'save login'
This commit is contained in:
Felix 2019-07-16 11:42:34 +01:00
parent e3ca987aa8
commit fef1621d3e
No known key found for this signature in database
GPG key ID: 130EF6DC43E4DD07
4 changed files with 15 additions and 9 deletions

View file

@ -6,13 +6,13 @@ PODS:
- Flutter - Flutter
DEPENDENCIES: DEPENDENCIES:
- Flutter (from `.symlinks/flutter/ios-profile`) - Flutter (from `.symlinks/flutter/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`) - url_launcher (from `.symlinks/plugins/url_launcher/ios`)
EXTERNAL SOURCES: EXTERNAL SOURCES:
Flutter: Flutter:
:path: ".symlinks/flutter/ios-profile" :path: ".symlinks/flutter/ios"
shared_preferences: shared_preferences:
:path: ".symlinks/plugins/shared_preferences/ios" :path: ".symlinks/plugins/shared_preferences/ios"
url_launcher: url_launcher:

View file

@ -281,7 +281,7 @@
); );
inputPaths = ( inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", "${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"; name = "[CP] Embed Pods Frameworks";
outputPaths = ( outputPaths = (

View file

@ -1,5 +1,5 @@
import 'dart:io';
import 'dart:async'; import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
@ -16,12 +16,18 @@ Future<LoginModel> requestLogoutAPI(BuildContext context) async {
token = result; token = result;
}); });
Map<String, String> body = {
"Token":token,
};
final response = await http.post( final response = await http.post(
url, url,
headers: {HttpHeaders.authorizationHeader: "Token $token"}, body: json.encode(body),
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
debugPrint("Logout successful: " + response.body);
saveLogout(); saveLogout();
return null; return null;
} else { } else {

View file

@ -62,10 +62,10 @@ Future<LoginModel> submitReceiptAPI(
print(responseJson[0]); print(responseJson[0]);
showDialogSingleButton( showDialogSingleButton(
context, context,
responseJson[0] == "" ? responseJson[0] : "Upload Successful", responseJson[0] == "" ? responseJson[0] : "Upload Successful",
"Transaction successfully submitted to server", "Transaction successfully submitted to server",
"OK" "OK"
); );
return LoginModel.fromJson(responseJson); return LoginModel.fromJson(responseJson);
} else { } else {