feat: 完成前端业务闭环与后端联调
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { hasRemoteConfig } from '@/utils/runtime-config.js'
|
||||
import {
|
||||
normalizeRegionCode,
|
||||
normalizeRegionParentCode,
|
||||
@@ -9,14 +8,8 @@ import {
|
||||
requestStrict
|
||||
} from './request-client.js'
|
||||
|
||||
const requireRemoteRegion = (label) => {
|
||||
if (hasRemoteConfig()) return
|
||||
throw createRequestError(`${label}读取需要真实服务,当前本地预览不会伪造结果`, 'REMOTE_READ_REQUIRED')
|
||||
}
|
||||
|
||||
export const regionApi = {
|
||||
async getRegionChildren(parentCode, requestOptions = {}) {
|
||||
requireRemoteRegion('地区选择')
|
||||
const regionChildren = await requestStrict({
|
||||
url: '/genealogy/app/region/children',
|
||||
method: 'GET',
|
||||
@@ -28,7 +21,6 @@ export const regionApi = {
|
||||
},
|
||||
|
||||
async getRegionPath(regionCode, requestOptions = {}) {
|
||||
requireRemoteRegion('行政区划路径')
|
||||
const regionPath = await requestStrict({
|
||||
url: `/genealogy/app/region/path/${encodeURIComponent(normalizeRegionCode(regionCode))}`,
|
||||
method: 'GET'
|
||||
|
||||
Reference in New Issue
Block a user