Files
msh-system/msh_single_admin/src/api/req.js
msh-agent ceac1c0340 feat(admin): add msh_single_admin project and harden ignore rules
Introduce the new Vue admin project into version control while tightening gitignore patterns to keep env files, logs, build artifacts, and test outputs out of commits.

Made-with: Cursor
2026-04-15 19:32:40 +08:00

33 lines
602 B
JavaScript
Executable File

import axios from 'axios';
const service = axios.create({
timeout: 40000,
});
service.interceptors.request.use(
(config) => {
return config;
},
(error) => {
Promise.reject(error);
},
);
// response interceptor
service.interceptors.response.use(
(response) => {
const res = response;
if (res.status !== 200 && res.status !== 401) {
Message({
message: res.data.msg || 'Error',
type: 'error',
duration: 5 * 1000,
});
return Promise.reject();
} else {
return res.data;
}
},
(error) => {},
);
export default service;