perf[permission]: add the verification of roles
This commit is contained in:
		@@ -67,7 +67,13 @@ const user = {
 | 
			
		||||
            reject('error')
 | 
			
		||||
          }
 | 
			
		||||
          const data = response.data
 | 
			
		||||
          commit('SET_ROLES', data.roles)
 | 
			
		||||
 | 
			
		||||
          if (data.roles && data.roles.length > 0) { // 验证返回的roles是否是一个非空数组
 | 
			
		||||
            commit('SET_ROLES', data.roles)
 | 
			
		||||
          } else {
 | 
			
		||||
            reject('getInfo: roles must be a non-null array !')
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          commit('SET_NAME', data.name)
 | 
			
		||||
          commit('SET_AVATAR', data.avatar)
 | 
			
		||||
          commit('SET_INTRODUCTION', data.introduction)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user