Bug Fixes:

- Fixed Navbar links (closes #8)
- Fixed Lyrics not updating
This commit is contained in:
Shiny Nematoda 2022-08-14 06:17:40 +00:00
parent 4ac524dcf2
commit e0bc3c61a2
No known key found for this signature in database
GPG key ID: 6506D50F5613A42D
6 changed files with 93 additions and 46 deletions

View file

@ -14,31 +14,29 @@ const data = useData(),
function get() {
status.value = false;
if (data.state.lyrics && data.state.urls === data.state.urls[0]?.url) {
getJsonHyp('/browse/' + data.state.lyrics).then(res => {
const set = id => {
getJsonHyp('/browse/' + id).then(res => {
text.value = res.text;
source.value = res.source;
status.value = true;
});
} else if (data.state.urls[0]?.url) {
getJsonHyp(
'/next/' + data.state.urls[0]?.url.replace('/watch?v=', ''),
).then(next => {
if (next.lyricsId) {
getJsonHyp('/browse/' + next.lyricsId).then(res => {
text.value = res.text;
source.value = res.source;
status.value = true;
});
}
});
};
if (data.state.lyrics && data.state.urls === data.state.url) {
set(data.state.lyrics);
} else if (data.state.url) {
getJsonHyp('/next/' + data.state.url.replace('/watch?v=', '')).then(
next => {
if (next.lyricsId) set(next.lyricsId);
},
);
}
}
get();
watch(
() => data.state.urls[0]?.url,
() => data.state.url,
() => {
get();
},