diff --git a/index.html b/index.html
index 695423e..52c3e3a 100644
--- a/index.html
+++ b/index.html
@@ -6,7 +6,7 @@
Vite App
-
+
\ No newline at end of file
diff --git a/src/store/index.ts b/src/store/index.ts
index 20f2875..8d5ae8d 100644
--- a/src/store/index.ts
+++ b/src/store/index.ts
@@ -1,5 +1,6 @@
import { createStore } from "vuex";
import { SongResult } from "@/type/music";
+import { getMusicUrl } from "@/api/music";
let state = {
menus: [
@@ -21,6 +22,7 @@ let state = {
],
isPlay: false,
playMusic: {} as SongResult,
+ playMusicUrl: "",
};
let mutations = {
@@ -28,17 +30,21 @@ let mutations = {
state.menus = menus;
},
setPlay(state: any, playMusic: SongResult) {
- console.log(playMusic);
-
state.playMusic = playMusic;
+ state.playMusicUrl = getSongUrl(playMusic.id);
},
setIsPlay(state: any, isPlay: boolean) {
- console.log(isPlay);
-
state.isPlay = isPlay;
},
};
+const getSongUrl = async (id: number) => {
+ const { data } = await getMusicUrl(id);
+ console.log(data.data[0].url);
+
+ return data.data[0].url;
+};
+
const store = createStore({
state: state,
mutations: mutations,