refactor: remove success notifications from api action wrappers and websocket connection
This commit is contained in:
7 files changed
+15
-32
No files matched your search
@@ -1,6 +1,5 @@
|
||||
import { onUnmounted, ref } from 'vue'
|
||||
import type { BotStatus } from '@/types/status'
|
||||
import { useToasts } from '@/composables/useToasts'
|
||||
import { getGuildId, setGuildId } from '@/api/client'
|
||||
|
||||
const RECONNECT_DELAY_MS = 3000
|
||||
@@ -13,13 +12,10 @@ const pendingTracks = ref<{ id: string; guildId: string; title: string }[]>([])
|
||||
|
||||
let socket: WebSocket | null = null
|
||||
let reconnectTimer: number | null = null
|
||||
let connectedOnce = false
|
||||
let subscribers = 0
|
||||
|
||||
/** Jedno połączenie WebSocket na aplikację, niezależnie od liczby komponentów. */
|
||||
export function useBotStatus() {
|
||||
const { notify } = useToasts()
|
||||
|
||||
function open() {
|
||||
const scheme = window.location.protocol === 'https:' ? 'wss:' : 'ws:'
|
||||
const guild = getGuildId()
|
||||
@@ -30,11 +26,6 @@ export function useBotStatus() {
|
||||
|
||||
currentSocket.onopen = () => {
|
||||
connected.value = true
|
||||
notify(
|
||||
connectedOnce ? 'Połączenie WebSocket przywrócone (Live)!' : 'WebSocket zsynchronizowany (Live)!',
|
||||
'success',
|
||||
)
|
||||
connectedOnce = true
|
||||
}
|
||||
|
||||
currentSocket.onmessage = (event) => {
|
||||
|
||||
@@ -40,7 +40,7 @@ export function useUploads() {
|
||||
}
|
||||
|
||||
async function enqueue(filename: string) {
|
||||
await run(() => api.playFile(filename), 'Dodano plik do kolejki!', 'Błąd odtwarzania')
|
||||
await run(() => api.playFile(filename), '', 'Błąd odtwarzania')
|
||||
await refresh()
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user