Added basic Text sending
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:marianum_mobile/api/apiError.dart';
|
||||
import 'package:marianum_mobile/api/apiRequest.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
@ -21,7 +22,7 @@ abstract class TalkApi<T> extends ApiRequest {
|
||||
|
||||
TalkApi(this.path, this.body, {this.headers, this.getParameters});
|
||||
|
||||
Future<http.Response> request(Uri uri, Object? body, Map<String, String>? headers);
|
||||
Future<http.Response>? request(Uri uri, ApiParams? body, Map<String, String>? headers);
|
||||
T assemble(String raw);
|
||||
|
||||
Future<T> run() async {
|
||||
@ -37,7 +38,10 @@ abstract class TalkApi<T> extends ApiRequest {
|
||||
headers?.putIfAbsent("Accept", () => "application/json");
|
||||
headers?.putIfAbsent("OCS-APIRequest", () => "true");
|
||||
|
||||
http.Response data = await request(endpoint, body, headers);
|
||||
http.Response? data = await request(endpoint, body, headers);
|
||||
if(data == null) {
|
||||
throw ApiError("Request could not be dispatched!");
|
||||
}
|
||||
//dynamic jsonData = jsonDecode(data.body);
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user