CN-162 代理接口调试页面开发
This commit is contained in:
@@ -118,7 +118,7 @@ export async function getI18n () {
|
||||
export async function getIso36112JsonData (suffix) {
|
||||
const request = new Promise(resolve => {
|
||||
axios({
|
||||
url: `${window.location.protocol}//${window.location.host}:${window.location.port}/geojson/${suffix}.json`,
|
||||
url: `${window.location.protocol}//${window.location.host}:${window.location.port}/geojson/${suffix}.json`
|
||||
}).then(response => {
|
||||
resolve(response.data || response || null)
|
||||
})
|
||||
|
||||
@@ -55,6 +55,36 @@ axios.interceptors.response.use(
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
export function getForDebug (url, params) {
|
||||
return new Promise((resolve) => {
|
||||
axios.get(url, {
|
||||
params: params
|
||||
}).then(response => {
|
||||
resolve(response)
|
||||
}).catch(err => {
|
||||
if (err.response) {
|
||||
resolve(err.response)
|
||||
} else if (err.message) {
|
||||
resolve(err.message)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export function postForDebug (url, params, headers) {
|
||||
return new Promise(resolve => {
|
||||
axios.post(url, params, { headers: headers }).then(response => {
|
||||
resolve(response, response)
|
||||
}).catch(err => {
|
||||
if (err.response) {
|
||||
resolve(err.response)
|
||||
} else if (err.message) {
|
||||
resolve(err.message)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export function get (url, params) {
|
||||
return new Promise((resolve) => {
|
||||
axios.get(url, {
|
||||
|
||||
Reference in New Issue
Block a user