diff --git a/src/components/guild/home/AudioPreviewComponent.vue b/src/components/guild/home/AudioPreviewComponent.vue
index c6bad22..7ea1227 100644
--- a/src/components/guild/home/AudioPreviewComponent.vue
+++ b/src/components/guild/home/AudioPreviewComponent.vue
@@ -4,9 +4,35 @@
mdi-music-circle
-
- {{ status.channel?.name }}
-
+
+
+
+ {{ status.channel?.name }}
+
+
+
+
+
+
+
+
+
+
+
+
@@ -140,12 +166,22 @@
variant="outlined"
>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/services/audioService.ts b/src/services/audioService.ts
index 31dab16..aae5189 100644
--- a/src/services/audioService.ts
+++ b/src/services/audioService.ts
@@ -29,4 +29,36 @@ function getAudioStatus(guildId: string): Promise {
});
}
-export { getAudioStatus };
+function connect(guildId: string, voiceChannelId: string): Promise {
+ return new Promise((resolve, reject) => {
+ const userStore = useUserStore();
+ axios
+ .post(
+ `/audio/${guildId}/connect`,
+ {
+ channelId: voiceChannelId,
+ },
+ {
+ headers: {
+ authorization: `Bearer ${userStore.token}`,
+ },
+ }
+ )
+ .then(() => {
+ resolve();
+ })
+ .catch((reason) => {
+ console.error(`Fail to connect to voice channel !`);
+ console.log(reason);
+ const eventQueuStore = useEventQueuStore();
+ eventQueuStore.push({
+ uuid: undefined,
+ type: "error",
+ text: "Fail to connect to voice channel !",
+ });
+ reject(reason);
+ });
+ });
+}
+
+export { getAudioStatus, connect };