vamos
All checks were successful
build-and-deploy / build (push) Successful in 23s
build-and-deploy / deploy (push) Successful in 3s

This commit is contained in:
2025-10-12 00:59:50 -06:00
parent 1f087eb6f3
commit 98fb972a4e
4 changed files with 173 additions and 34 deletions

View File

@@ -129,11 +129,28 @@ export const useMusicStore = defineStore('music', {
try {
const encodedName = encodeURIComponent(name)
const response = await fetch(`/api/music/${encodedName}`)
if (!response.ok) throw new Error(`HTTP ${response.status}`)
if (!response.ok) {
const errorMsg = `HTTP ${response.status}`
// Detect authentication errors
if (response.status === 401 || response.status === 403) {
console.warn('[Music Store] Cache failed - authentication error:', response.status)
this.error = `${errorMsg}: Unauthorized - Please log in`
}
throw new Error(errorMsg)
}
const blob = await response.blob()
await this.saveTrackBlob(name, blob, duration)
return true
} catch (e) {
} catch (e: any) {
console.error('[Music Store] Cache failed:', e)
// Propagate auth errors
if (e?.message?.includes('401') || e?.message?.includes('403')) {
this.error = e.message
}
return false
}
}