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
This commit is contained in:
32
msh_single_admin/src/api/req.js
Executable file
32
msh_single_admin/src/api/req.js
Executable file
@@ -0,0 +1,32 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user