Add alarm endpoints, basic budget routes, spend history
3 files changed, 39 insertions, 61 deletions
diff --git a/testFrontend/SafeNSound.Frontend/Pages/Alarm.razor b/testFrontend/SafeNSound.Frontend/Pages/Alarm.razor
new file mode 100644
index 0000000..9b90ef4
--- /dev/null
+++ b/testFrontend/SafeNSound.Frontend/Pages/Alarm.razor
@@ -0,0 +1,36 @@
+@page "/Alarm"
+
+<h1>Alarm</h1>
+
+<br/><br/>
+
+@if (Exception != null) {
+ <div class="alert alert-danger">
+ <strong>Error:</strong><br/>
+ <pre>
+ @Exception
+ </pre>
+ </div>
+}
+
+@if (Result != null) {
+ <div class="alert alert-success">
+ <strong>Result:</strong><br/>
+ <pre>
+ @Result.ToJson(indent: true)
+ </pre>
+ </div>
+}
+
+@code {
+ private Exception? Exception { get; set; }
+ private object? Result { get; set; }
+
+ protected override async Task OnInitializedAsync() {
+ if (App.Client is null) {
+ NavigationManager.NavigateTo("/Auth");
+ return;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/testFrontend/SafeNSound.Frontend/Pages/Auth.razor b/testFrontend/SafeNSound.Frontend/Pages/Auth.razor
index 3db77a1..c58a996 100644
--- a/testFrontend/SafeNSound.Frontend/Pages/Auth.razor
+++ b/testFrontend/SafeNSound.Frontend/Pages/Auth.razor
@@ -73,11 +73,13 @@
Result = null;
Exception = null;
try {
- Result = await Authentication.Login(new() {
+ SafeNSoundAuthResult result;
+ Result = result = await Authentication.Login(new() {
Username = Username,
Password = Password,
Email = Email
});
+ App.Client = new SafeNSoundClient(Config, result.AccessToken);
}
catch (Exception ex) {
Exception = ex;
diff --git a/testFrontend/SafeNSound.Frontend/Pages/Weather.razor b/testFrontend/SafeNSound.Frontend/Pages/Weather.razor
deleted file mode 100644
index a0ca515..0000000
--- a/testFrontend/SafeNSound.Frontend/Pages/Weather.razor
+++ /dev/null
@@ -1,60 +0,0 @@
-@page "/weather"
-@inject HttpClient Http
-
-<PageTitle>Weather</PageTitle>
-
-<h1>Weather</h1>
-
-<p>This component demonstrates fetching data from the server.</p>
-
-@if (forecasts == null)
-{
- <p>
- <em>Loading...</em>
- </p>
-}
-else
-{
- <table class="table">
- <thead>
- <tr>
- <th>Date</th>
- <th aria-label="Temperature in Celsius">Temp. (C)</th>
- <th aria-label="Temperature in Farenheit">Temp. (F)</th>
- <th>Summary</th>
- </tr>
- </thead>
- <tbody>
- @foreach (var forecast in forecasts)
- {
- <tr>
- <td>@forecast.Date.ToShortDateString()</td>
- <td>@forecast.TemperatureC</td>
- <td>@forecast.TemperatureF</td>
- <td>@forecast.Summary</td>
- </tr>
- }
- </tbody>
- </table>
-}
-
-@code {
- private WeatherForecast[]? forecasts;
-
- protected override async Task OnInitializedAsync()
- {
- forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
- }
-
- public class WeatherForecast
- {
- public DateOnly Date { get; set; }
-
- public int TemperatureC { get; set; }
-
- public string? Summary { get; set; }
-
- public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
- }
-
-}
\ No newline at end of file
|