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
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:

View file

@ -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 = (

View file

@ -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<LoginModel> requestLogoutAPI(BuildContext context) async {
token = result;
});
Map<String, String> 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 {

View file

@ -62,10 +62,10 @@ Future<LoginModel> 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 {