Add Save function, Visuals, Stuff

This commit is contained in:
2024-09-25 15:32:58 +02:00
parent a066b9caba
commit 3f2191673e
7 changed files with 250 additions and 235 deletions

View File

@@ -33,7 +33,8 @@ namespace Jugenddienst_Stunden.Models {
//private static readonly string requestUrl = $"{BaseAddress}/appapi?hours";
//public static string apiKey = "Mnx6amdpUkFCdWMvc0lmZ3dWeXRVSWx3VGRDRDh8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp"; //Daniel Pichler
//public static string apiKey = "M3xraUdoSktrdGowaUZoaStJbDJLWmIyTFhYeDh8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp"; //Daniel Pichler
public static async Task<Hours> LoadData() {
@@ -41,6 +42,8 @@ namespace Jugenddienst_Stunden.Models {
//Temporär fix für virtuelle App
//apiKey = "NXw5eFF0RVQ5TFBMTXFVeFIzQURtd01idHFUb2d8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp"; //Johannes Fink
//apiKey = "M3xraUdoSktrdGowaUZoaStJbDJLWmIyTFhYeDh8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp"; //Lea Mair
//apiKey = "Mnx6amdpUkFCdWMvc0lmZ3dWeXRVSWx3VGRDRDh8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp"; //Daniel Pichler
Hours hours = new Hours();
@@ -55,7 +58,7 @@ namespace Jugenddienst_Stunden.Models {
//string data = await Auth.GetApiDataWithAuthAsync(requestUrl, apiKey);
string data = await Auth.GetApiDataWithAuthAsync(tokendata.url + "?hours", tokendata.apiKey);
if (data == null) {
if (data == "null") {
throw new Exception("Keine Daten erhalten");
}
if (data == "\"Lalala\"") {
@@ -83,8 +86,8 @@ namespace Jugenddienst_Stunden.Models {
//string data = await Auth.GetApiDataWithAuthAsync(requestUrl, apiKey);
string data = await Auth.GetApiDataWithAuthAsync(tokendata.url + "?date=" + date.ToString("yyyy-MM-dd"), tokendata.apiKey);
if (data == null) {
throw new Exception("Keine Daten erhalten");
if (data == "null") {
throw new Exception("Keine Daten für " + date.ToString("ddd. dd. MMM") + " erhalten");
}
if (data == "\"Lalala\"") {
throw new Exception("Problem mit Token");
@@ -128,5 +131,12 @@ namespace Jugenddienst_Stunden.Models {
};
}
public static async Task<DayTime> SaveEntry(DayTime stunde) { //, string begin, string end, string freistellung, string bemerkung) {
var tokendata = new TokenData(apiKey);
await Auth.SaveItemAsync(tokendata.url, tokendata.apiKey, stunde,false);
return null;
}
}
}