feat: 页面配置首次编辑时默认初始化所有页面类型,删除不需要的比逐个添加更高效
This commit is contained in:
@@ -242,7 +242,11 @@ const editPage = async (row) => {
|
||||
const r = await api.raw.get(url)
|
||||
const data = r?.data || r
|
||||
authType.value = data?.authType || 'NONE'
|
||||
editorJson.value = JSON.stringify({ authType: authType.value, entries: data?.entries || [] }, null, 2)
|
||||
const existing = data?.entries || []
|
||||
// 无配置则默认初始化所有页面类型
|
||||
const entries = existing.length ? existing
|
||||
: pageKeys.value.map(k => ({ key: k.key, method: k.defaultMethod || 'GET', url: '' }))
|
||||
editorJson.value = JSON.stringify({ authType: authType.value, entries }, null, 2)
|
||||
} catch { editorJson.value = JSON.stringify({ authType:'NONE', entries:[] }, null, 2) }
|
||||
originalJson.value = editorJson.value
|
||||
if (!row.siteId.startsWith('default:')) fetchSnapshotStatus()
|
||||
|
||||
Reference in New Issue
Block a user