🔨 Finish add
This commit is contained in:
parent
b5707a7bca
commit
9a8f1b112a
@ -164,7 +164,6 @@
|
||||
variant="outlined"
|
||||
label="Url"
|
||||
hide-details="auto"
|
||||
@change="add"
|
||||
color="primary"
|
||||
autofocus
|
||||
:loading="urlLoading"
|
||||
@ -462,6 +461,19 @@ function stop() {
|
||||
function add() {
|
||||
if (url.value) {
|
||||
urlLoading.value = true;
|
||||
audioService
|
||||
.add(properties.guild.id, url.value)
|
||||
.then((value) => {
|
||||
if (value) {
|
||||
status.value = value.data;
|
||||
}
|
||||
urlLoading.value = false;
|
||||
urlPopup.value = false;
|
||||
url.value = "";
|
||||
})
|
||||
.catch(() => {
|
||||
urlLoading.value = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,4 +169,30 @@ function stop(guildId: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export { getAudioStatus, connect, disconnect, resume, pause, skip, stop };
|
||||
function add(guildId: string, url: string) {
|
||||
const userStore = useUserStore();
|
||||
return axios
|
||||
.post<Status>(
|
||||
`/audio/${guildId}/add`,
|
||||
{
|
||||
url: url,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
authorization: `Bearer ${userStore.token}`,
|
||||
},
|
||||
}
|
||||
)
|
||||
.catch((reason) => {
|
||||
console.error(`Fail to add track to playlist !`);
|
||||
console.log(reason);
|
||||
const eventQueuStore = useEventQueuStore();
|
||||
eventQueuStore.push({
|
||||
uuid: undefined,
|
||||
type: "error",
|
||||
text: "Fail to add track to playlist !",
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export { getAudioStatus, connect, disconnect, resume, pause, skip, stop, add };
|
||||
|
Loading…
Reference in New Issue
Block a user