aboutsummaryrefslogtreecommitdiff
path: root/resources/views/pages/music.blade.php
diff options
context:
space:
mode:
authorFrankie B <git@diskfloppy.me>2023-09-08 23:19:40 +0100
committerGitHub <noreply@github.com>2023-09-08 23:19:40 +0100
commit26901f82220fe18c0ad6e2bfc23c59b451a4e198 (patch)
treeb199f4d6680b8b62869e5062768e519db846511d /resources/views/pages/music.blade.php
parent5d148485408bb169cba60c9a82d188442630d233 (diff)
feat: add error handling (#14)
* Remove commented out crap * Update theme to use some colors from catppuccin, add error handling for API/DB
Diffstat (limited to 'resources/views/pages/music.blade.php')
-rw-r--r--resources/views/pages/music.blade.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/resources/views/pages/music.blade.php b/resources/views/pages/music.blade.php
index 3e97daa..775157a 100644
--- a/resources/views/pages/music.blade.php
+++ b/resources/views/pages/music.blade.php
@@ -7,6 +7,19 @@
$cfg = app('config')->get('services')['lastfm'];
$api_root = app('config')->get('app')['api_root'];
+ $api_alive = true;
+
+ try {
+ $data = file_get_contents($api_root.'/lastfm/current');
+ } catch (Exception $e) {
+ $api_alive = false;
+ }
+ @endphp
+ @if (!$api_alive)
+ @include('components.errors.api-error')
+ @else
+
+ @php
$current_track = json_decode(file_get_contents($api_root . '/lastfm/current'));
$top_tracks = json_decode(file_get_contents($api_root . '/lastfm/top'));
$count = 0;
@@ -51,4 +64,5 @@
</tr>
@endforeach
</table>
+ @endif
@stop