+
![]()
+
Song: {{ song.item.name }}
+
Artist: {{ song.item.artists[0].name }}
Is what im currently listening to rnrnrn ^_^
@@ -15,29 +15,16 @@
import { ref, onMounted } from "vue";
export default {
- name: "SpotifyNowPlaying",
+ name: "spotify-listening",
setup() {
- const albumImage = ref("");
- const artistName = ref("");
- const songName = ref("");
- const songUrl = ref("");
- const playing = ref(false);
+ const song = ref({});
async function fetchSpotify() {
try {
- const res = await fetch("/api/spotify");
+ const res = await fetch("/api/spotify/listening");
if (!res.ok) throw new Error("Failed to fetch Spotify data");
- const data = await res.json();
- if (playing.value == false) {
- return;
- } else {
- albumImage.value = data.album_image;
- artistName.value = data.artist_name;
- songUrl.value = data.song_url;
- songName.value = data.song_name;
- playing.value = data.playing;
- return;
- }
+ song.value = await res.json();
+ console.log(data);
} catch (err) {
console.error(err);
}
diff --git a/nginx/vue/src/components/spotify/Recent.vue b/nginx/vue/src/components/spotify/Recent.vue
new file mode 100644
index 0000000..2bab166
--- /dev/null
+++ b/nginx/vue/src/components/spotify/Recent.vue
@@ -0,0 +1,63 @@
+
+
+
![]()
+
Song: {{ song.item.name }}
+
Artist: {{ song.item.artists[0].name }}
+
Is what im currently listening to rnrnrn ^_^
+
+
+
+
+
+
diff --git a/nginx/vue/src/views/Home.vue b/nginx/vue/src/views/Home.vue
index 6c127a9..fa030a6 100644
--- a/nginx/vue/src/views/Home.vue
+++ b/nginx/vue/src/views/Home.vue
@@ -1,5 +1,6 @@
@@ -49,8 +50,13 @@ import Radio from "@/components/Radio.vue";