vue-cli-plugin-apmapi
v1.0.13
Published
apmApi config for private
Downloads
45
Readme
vue-cli-plugin-apmapi
A Vue CLI Plugin for apmApi config [vue-cli version > 3]
install & usage
vue add apmapi
config axios
import axios from 'axios'
import { InitApm } from '@/plugins/apmApi'
function serves(serve: string) {
const apm = new InitApm('app name'); // apm
apm.apmInit(); // apm
const service = axios.create({
// config ...
});
// axios
service.interceptors.request.use(
(config) => {
apm.ampHanleRequest(config); // apm
return config;
},
(error) => {
return Promise.reject(error)
}
);
service.interceptors.response.use(
(response) => {
apm.apmHandleResponse(response); // apm
return response;
},
(error) => {
apm.apmHandleResponseError(error); // apm
// handle error ...
}
)
return service
}
export default serves