feat(admin): rebuild page display settings
This commit is contained in:
@@ -19,12 +19,11 @@ function normalizeDomainKey(domain) {
|
||||
/**
|
||||
* Join REST base + endpoint correctly for both pretty and plain permalinks.
|
||||
*
|
||||
* Pretty: https://site/wp-json/aksrt/v1 + /banners?kind=x
|
||||
* → https://site/wp-json/aksrt/v1/banners?kind=x
|
||||
* Pretty: https://site/wp-json/aksrt/v1 + /settings/schema/global/common
|
||||
* → https://site/wp-json/aksrt/v1/settings/schema/global/common
|
||||
*
|
||||
* Plain: https://site/index.php?rest_route=/aksrt/v1 + /banners?kind=x
|
||||
* → https://site/index.php?rest_route=/aksrt/v1/banners&kind=x
|
||||
* (must NOT produce rest_route=/aksrt/v1/banners?kind=x)
|
||||
* Plain: https://site/index.php?rest_route=/aksrt/v1 + /settings/schema/global/common
|
||||
* → https://site/index.php?rest_route=/aksrt/v1/settings/schema/global/common
|
||||
*
|
||||
* @param {string} baseUrl
|
||||
* @param {string} endpoint path starting with /, may include ?query
|
||||
|
||||
@@ -7,9 +7,6 @@ export const globalApiMethods = {
|
||||
saveMailSettings(data) { return this.request('/settings/mail', { method: 'POST', body: JSON.stringify(data) }) },
|
||||
testMail(to) { return this.request('/mail/test', { method: 'POST', body: JSON.stringify({ to }) }) },
|
||||
|
||||
getFooterSettings() { return this.request('/settings/footer') },
|
||||
saveFooterSettings(data) { return this.request('/settings/footer', { method: 'POST', body: JSON.stringify(data) }) },
|
||||
|
||||
getFooterTabbarSettings() { return this.request('/settings/footer-tabbar') },
|
||||
saveFooterTabbarSettings(data) { return this.request('/settings/footer-tabbar', { method: 'POST', body: JSON.stringify(data) }) },
|
||||
reorderFooterTabbar(ids) { return this.request('/settings/footer-tabbar/reorder', { method: 'POST', body: JSON.stringify({ ids }) }) },
|
||||
|
||||
@@ -3,10 +3,6 @@ export const pageDisplayApiMethods = {
|
||||
* 页面&显示 (Page Display)
|
||||
* ================================================================ */
|
||||
|
||||
getHomepageSettings() { return this.request('/settings/homepage') },
|
||||
saveHomepageSettings(data) { return this.request('/settings/homepage', { method: 'POST', body: JSON.stringify(data) }) },
|
||||
getHomepageCategories() { return this.request('/homepage/categories') },
|
||||
|
||||
getCategoryRecommendSettings() { return this.request('/settings/category-recommend') },
|
||||
saveCategoryRecommendSettings(data) { return this.request('/settings/category-recommend', { method: 'POST', body: JSON.stringify(data) }) },
|
||||
getCategories(taxonomy = 'category') {
|
||||
@@ -16,13 +12,9 @@ export const pageDisplayApiMethods = {
|
||||
updateCategoryMeta(id, data) { return this.request(`/categories/${id}/meta`, { method: 'POST', body: JSON.stringify(data) }) },
|
||||
searchUsers(search = '', number = 20) { return this.request(`/users/search?search=${encodeURIComponent(search)}&number=${number}`) },
|
||||
|
||||
getBanners() { return this.request('/banners') },
|
||||
createBanner(data) { return this.request('/banners', { method: 'POST', body: JSON.stringify(data) }) },
|
||||
updateBanner(id, data) { return this.request(`/banners/${id}`, { method: 'PUT', body: JSON.stringify(data) }) },
|
||||
deleteBanner(id) { return this.request(`/banners/${id}`, { method: 'DELETE' }) },
|
||||
|
||||
getHomepageBanners() { return this.getBanners() },
|
||||
createHomepageBanner(data) { return this.createBanner(data) },
|
||||
updateHomepageBanner(id, data) { return this.updateBanner(id, data) },
|
||||
deleteHomepageBanner(id) { return this.deleteBanner(id) },
|
||||
searchPageDisplayOptions(source, query = '', include = []) {
|
||||
const params = new URLSearchParams({ query })
|
||||
include.forEach(value => params.append('include[]', value))
|
||||
return this.request(`/settings/schema/page_display/search/${encodeURIComponent(source)}?${params}`)
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user