Added central user credentials management

This commit is contained in:
2023-06-11 18:18:37 +02:00
parent 04c244503e
commit 1521056217
22 changed files with 207 additions and 159 deletions

View File

@ -1,8 +1,8 @@
import 'dart:developer';
import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart';
import '../../../model/accountData.dart';
import '../../apiError.dart';
import '../../apiParams.dart';
import '../../apiRequest.dart';
@ -32,9 +32,7 @@ abstract class TalkApi<T> extends ApiRequest {
getParameters?.update(key, (value) => value.toString());
});
SharedPreferences preferences = await SharedPreferences.getInstance();
Uri endpoint = Uri.https("${preferences.getString("username")!}:${preferences.getString("password")!}@cloud.marianum-fulda.de", "/ocs/v2.php/apps/spreed/api/$path", getParameters);
Uri endpoint = Uri.https("${AccountData().buildHttpAuthString()}@cloud.marianum-fulda.de", "/ocs/v2.php/apps/spreed/api/$path", getParameters);
headers ??= {};
headers?.putIfAbsent("Accept", () => "application/json");