16 lines
353 B
JavaScript
16 lines
353 B
JavaScript
|
|
import axios from 'axios'
|
||
|
|
|
||
|
|
const service = axios.create({
|
||
|
|
baseURL: '',
|
||
|
|
timeout: 10000
|
||
|
|
})
|
||
|
|
|
||
|
|
export async function request(config) {
|
||
|
|
const res = await service(config)
|
||
|
|
if (res === null || res === undefined) {
|
||
|
|
return res
|
||
|
|
}
|
||
|
|
if (Object.prototype.hasOwnProperty.call(res, 'data')) {
|
||
|
|
return res.data
|
||
|
|
}
|
||
|
|
}
|