move reportUrl and reportProjectId from config to setting

This commit is contained in:
tzw
2024-10-07 20:42:45 +06:30
parent ff55b219e3
commit 966758d2f8
15 changed files with 75 additions and 69 deletions

View File

@@ -37,7 +37,7 @@ Future<dynamic> requestAPI(String path, method,
if (devInfo.deviceID != null) {
headers["Device"] = devInfo.deviceID ?? "" + ":" + deviceName;
}
headers["Project-ID"] = Config.instance.reportProjectID;
headers["Project-ID"] = Services.setting.reportProjectID;
BaseOptions options = new BaseOptions(
method: method,
@@ -99,7 +99,7 @@ Future<dynamic> requestDownloadAPI(String path, method,
var _downloadData = StringBuffer();
var fileSave = new File(filePath!);
var request = await client.getUrl(Uri.parse("$baseUrl$path"));
request.headers.set("Project-ID", Config.instance.reportProjectID);
request.headers.set("Project-ID", Services.setting.reportProjectID);
request.headers
.set(HttpHeaders.contentTypeHeader, "application/json; charset=UTF-8");
if (token != null) {
@@ -140,7 +140,7 @@ Future<dynamic> requestDownloadPDFAPI(String path, method,
// var _downloadData = StringBuffer();
var fileSave = new File(filePath!);
var request = await client.getUrl(Uri.parse("$baseUrl$path"));
request.headers.set("Project-ID", Config.instance.reportProjectID);
request.headers.set("Project-ID", Services.setting.reportProjectID);
if (token != null) {
request.headers.set("Token", token);
}
@@ -188,7 +188,7 @@ Future<dynamic> requestDownload(String path, method,
HttpClient client = new HttpClient();
// var _downloadData = StringBuffer();
var request = await client.postUrl(Uri.parse("$baseUrl$path"));
request.headers.set("Project-ID", Config.instance.reportProjectID);
request.headers.set("Project-ID", Services.setting.reportProjectID);
if (token != null) {
request.headers.set("Token", token);
}
@@ -244,7 +244,7 @@ Future<File> downloadPDF(
await requestDownload("/api/pdf", "POST",
filePath: path,
url: Config.instance.reportURL,
url: Services.setting.reportURL,
token: await getToken(),
payload: jsonEncode(data), onDownloadDone: (f) async {
completer.complete(f);