2025-10-30 16:34:29 +08:00
|
|
|
import axios from 'axios'
|
|
|
|
|
|
|
|
|
|
const service = axios.create({
|
|
|
|
|
baseURL: '',
|
|
|
|
|
timeout: 10000
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export async function request(config) {
|
2025-10-31 16:16:56 +08:00
|
|
|
try {
|
|
|
|
|
const res = await service(config)
|
|
|
|
|
if (res === null || res === undefined) {
|
|
|
|
|
return res
|
|
|
|
|
}
|
|
|
|
|
if (Object.prototype.hasOwnProperty.call(res, 'data')) {
|
|
|
|
|
return res.data
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log(error)
|
|
|
|
|
return null
|
2025-10-30 16:34:29 +08:00
|
|
|
}
|
|
|
|
|
}
|