refactor: 重命名客户端工程
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import axios from 'axios';
|
||||
|
||||
const instance = axios.create({ baseURL: '/api', timeout: 20000 });
|
||||
|
||||
instance.interceptors.response.use(
|
||||
(res) => {
|
||||
const body = res.data;
|
||||
if (body && typeof body === 'object' && 'code' in body) {
|
||||
return body.code === 0 ? body.data : Promise.reject(body);
|
||||
}
|
||||
return body;
|
||||
},
|
||||
(err) => Promise.reject(err),
|
||||
);
|
||||
|
||||
export function fetchTrace(shortCode: string): Promise<any> {
|
||||
return instance.get(`/public/trace/${shortCode}`) as unknown as Promise<any>;
|
||||
}
|
||||
|
||||
export function fetchAppInfo(): Promise<any> {
|
||||
return instance.get('/settings/public') as unknown as Promise<any>;
|
||||
}
|
||||
Reference in New Issue
Block a user