소스 검색

fix Authorize error in ie11

陈帅 7 년 전
부모
커밋
8290e24d8d
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      src/components/Authorized/renderAuthorize.js

+ 3 - 3
src/components/Authorized/renderAuthorize.js

@@ -6,12 +6,12 @@ let CURRENT = 'NULL';
  */
 const renderAuthorize = Authorized => currentAuthority => {
   if (currentAuthority) {
-    if (currentAuthority.constructor.name === 'Function') {
+    if (typeof currentAuthority === 'function') {
       CURRENT = currentAuthority();
     }
     if (
-      currentAuthority.constructor.name === 'String' ||
-      currentAuthority.constructor.name === 'Array'
+      Object.prototype.toString.call(currentAuthority) === '[object String]' ||
+      Array.isArray(currentAuthority)
     ) {
       CURRENT = currentAuthority;
     }