Initial commit

This commit is contained in:
2024-08-20 01:37:51 +02:00
commit 68ccf23f01
62 changed files with 2121 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
using CommunityToolkit.Mvvm.ComponentModel;
using Newtonsoft.Json;
namespace Jugenddienst_Stunden.Models {
internal class Stunde : ObservableObject {
private static readonly string BaseAddress = "http://hours.dauni.mine.nu:81";
private static readonly string apiKey = "MTQzfEFlMVRjQXdZMnI4RmpxZ0FSY3A0VEN2bVZYVXxodHRwOi8vaG91cnMuZGF1bmkubWluZS5udTo4MS9hcHBhcGk="; //Christine
private static readonly string requestUrl = $"{BaseAddress}/appapi?hours";
public DateTime Date { get; set; }
public static async Task<Hours> LoadData() {
string data = await Auth.GetApiDataWithAuthAsync(requestUrl, apiKey);
if(data == null) {
throw new Exception("Keine Daten erhalten");
}
Hours hours = JsonConvert.DeserializeObject<Hours>(data);
return hours ?? new Hours();
}
}
}