Browse Source

Fix firefox error, close #677

pull/713/head
afc163 8 years ago
parent
commit
3c03f22231
  1. 7
      src/components/Authorized/CheckPermissions.js

7
src/components/Authorized/CheckPermissions.js

@ -1,6 +1,11 @@
import React from 'react';
import PromiseRender from './PromiseRender';
import { CURRENT } from './index';
function isPromise(obj) {
return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
}
/**
* 通用权限检查方法
* Common check permissions method
@ -32,7 +37,7 @@ const checkPermissions = (authority, currentAuthority, target, Exception) => {
}
// Promise 处理
if (authority.constructor.name === 'Promise') {
if (isPromise(authority)) {
return () => (
<PromiseRender ok={target} error={Exception} promise={authority} />
);

Loading…
Cancel
Save