mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-11-04 09:01:37 +08:00 
			
		
		
		
	修复:在生产环境启用 mock(参考:arco-design/arco-design-pro-vue#158)
This commit is contained in:
		@@ -1,7 +1,11 @@
 | 
			
		||||
import debug from './env';
 | 
			
		||||
// import debug from './env';
 | 
			
		||||
 | 
			
		||||
export default ({ mock, setup }: { mock?: boolean; setup: () => void }) => {
 | 
			
		||||
  if (mock !== false && debug) setup();
 | 
			
		||||
  // 仅在开发环境启用 mock
 | 
			
		||||
  // if (mock !== false && debug) setup();
 | 
			
		||||
 | 
			
		||||
  // 在生产环境也启用 mock
 | 
			
		||||
  if (mock !== false) setup();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const successResponseWrap = (data: unknown) => {
 | 
			
		||||
@@ -10,6 +14,7 @@ export const successResponseWrap = (data: unknown) => {
 | 
			
		||||
    success: true,
 | 
			
		||||
    code: 200,
 | 
			
		||||
    msg: '操作成功',
 | 
			
		||||
    timestamp: new Date().toLocaleDateString().replace(/\//g, '-'),
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -19,5 +24,6 @@ export const failResponseWrap = (data: unknown, msg: string, code = 500) => {
 | 
			
		||||
    success: false,
 | 
			
		||||
    code,
 | 
			
		||||
    msg,
 | 
			
		||||
    timestamp: new Date().toLocaleDateString().replace(/\//g, '-'),
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user