Update theme to use some colors from catppuccin, add error handling for API/DB
This commit is contained in:
parent
88b5abee0b
commit
689c494928
7 changed files with 85 additions and 14 deletions
|
|
@ -13,10 +13,22 @@ function degreesToCompassDirection($degrees) {
|
|||
return $cardinalDirections[round($degrees*16/360)];
|
||||
}
|
||||
|
||||
$data = json_decode(file_get_contents($api_root.'/weather'));
|
||||
$updated = gmdate('H:i Y-m-d', $data->updated);
|
||||
$data = $data->current;
|
||||
$api_alive = true;
|
||||
|
||||
try {
|
||||
$data = file_get_contents($api_root.'/weather');
|
||||
} catch (Exception $e) {
|
||||
$api_alive = false;
|
||||
}
|
||||
@endphp
|
||||
@if (!$api_alive)
|
||||
@include('components.errors.api-error')
|
||||
@else
|
||||
@php
|
||||
$data = json_decode(file_get_contents($api_root.'/weather'));
|
||||
$updated = gmdate('H:i Y-m-d', $data->updated);
|
||||
$data = $data->current;
|
||||
@endphp
|
||||
<table class="info-table">
|
||||
<caption>
|
||||
<h1>Local Weather</h1>
|
||||
|
|
@ -45,4 +57,5 @@ function degreesToCompassDirection($degrees) {
|
|||
</table>
|
||||
<br>
|
||||
<small><i>(Last Update: {{ $updated }})</i></small>
|
||||
@endif
|
||||
@stop
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue