fix: improve Settings page error message for MarkBase config failures
- loadSettings now shows detailed error from MarkBase response body - MarkBase /api/v2/config returns 500 when config file is incomplete - Error message now includes actual error details instead of just HTTP status
This commit is contained in:
@@ -1037,7 +1037,11 @@ async function loadSettings() {
|
|||||||
saveMessage.value = ''
|
saveMessage.value = ''
|
||||||
try {
|
try {
|
||||||
const resp = await fetch(`${markbaseUrl.value}/api/v2/config`)
|
const resp = await fetch(`${markbaseUrl.value}/api/v2/config`)
|
||||||
if (!resp.ok) throw new Error(`HTTP ${resp.status}`)
|
if (!resp.ok) {
|
||||||
|
// MarkBase config may return 500 if config file is incomplete
|
||||||
|
const errData = await resp.json().catch(() => null)
|
||||||
|
throw new Error(`HTTP ${resp.status}: ${errData?.error || resp.statusText}`)
|
||||||
|
}
|
||||||
const cfg = await resp.json()
|
const cfg = await resp.json()
|
||||||
uploadPath.value = cfg.server?.upload_path || ''
|
uploadPath.value = cfg.server?.upload_path || ''
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
|
|||||||
Reference in New Issue
Block a user