mirror of
				https://github.com/1Panel-dev/1Panel.git
				synced 2025-11-01 03:37:19 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
	
		
			807 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
	
		
			807 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| import i18n from '@/lang';
 | |
| import router from '@/routers';
 | |
| import { MsgError } from '@/utils/message';
 | |
| 
 | |
| /**
 | |
|  * @description: 校验网络请求状态码
 | |
|  * @param {Number} status
 | |
|  * @return void
 | |
|  */
 | |
| export const checkStatus = (status: number): void => {
 | |
|     switch (status) {
 | |
|         case 400:
 | |
|             MsgError(i18n.global.t('commons.res.paramError'));
 | |
|             break;
 | |
|         case 404:
 | |
|             MsgError(i18n.global.t('commons.res.notFound'));
 | |
|             break;
 | |
|         case 403:
 | |
|             router.replace({ path: '/' });
 | |
|             MsgError(i18n.global.t('commons.res.forbidden'));
 | |
|             break;
 | |
|         case 500:
 | |
|             MsgError(i18n.global.t('commons.res.serverError'));
 | |
|             break;
 | |
|         default:
 | |
|             MsgError(i18n.global.t('commons.res.commonError'));
 | |
|     }
 | |
| };
 |