修复了2个bug
This commit is contained in:
1 parent
ce8372e878
commit
2a64dc7395
64 files changed
+1050
-39
No files matched your search
@@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[339],{63:(e,a,t)=>{"use strict";var n=t(7260);t.o(n,"usePathname")&&t.d(a,{usePathname:function(){return n.usePathname}}),t.o(n,"useRouter")&&t.d(a,{useRouter:function(){return n.useRouter}})},525:(e,a,t)=>{Promise.resolve().then(t.bind(t,6006))},1360:(e,a,t)=>{"use strict";t.d(a,{A:()=>n});let n=(0,t(1847).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},1847:(e,a,t)=>{"use strict";t.d(a,{A:()=>l});var n=t(2115);let s=function(){for(var e=arguments.length,a=Array(e),t=0;t<e;t++)a[t]=arguments[t];return a.filter((e,a,t)=>!!e&&""!==e.trim()&&t.indexOf(e)===a).join(" ").trim()};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let r=(0,n.forwardRef)((e,a)=>{let{color:t="currentColor",size:r=24,strokeWidth:l=2,absoluteStrokeWidth:o,className:c="",children:u,iconNode:d,...h}=e;return(0,n.createElement)("svg",{ref:a,...i,width:r,height:r,stroke:t,strokeWidth:o?24*Number(l)/Number(r):l,className:s("lucide",c),...h},[...d.map(e=>{let[a,t]=e;return(0,n.createElement)(a,t)}),...Array.isArray(u)?u:[u]])}),l=(e,a)=>{let t=(0,n.forwardRef)((t,i)=>{let{className:l,...o}=t;return(0,n.createElement)(r,{ref:i,iconNode:a,className:s("lucide-".concat(e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),l),...o})});return t.displayName="".concat(e),t}},4577:(e,a,t)=>{"use strict";t.d(a,{BrowserAuthGuard:()=>u,BrowserAuthProvider:()=>o,ClientRedirect:()=>d,a:()=>c});var n=t(5155),s=t(2115),i=t(63),r=t(6660);let l=(0,s.createContext)(null);function o(e){let{children:a}=e,[t,i]=(0,s.useState)(null),[o,c]=(0,s.useState)("loading"),[u,d]=(0,s.useState)(null),h=(0,s.useCallback)(async e=>{try{let a=await (0,r.uK)(e);i(a),c("ready"),d(null)}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;c("error"),d(e instanceof Error?e.message:"无法读取认证状态")}},[]);(0,s.useEffect)(()=>{let e=new AbortController;return h(e.signal),()=>e.abort()},[h]);let m=(0,s.useMemo)(()=>{var e,a;let n=(null==t?void 0:t.user)||null,s=null==(e=null==t?void 0:t.authRequired)||e,i=!s||(null==n?void 0:n.role)==="super_admin",r=i||(null==n?void 0:n.role)==="organization_admin";return{status:o,user:n,authMode:(null==t?void 0:t.authMode)||null,authRequired:s,authConfigured:null!=(a=null==t?void 0:t.authConfigured)&&a,isAdmin:r,isSuperAdmin:i,error:u,refresh:()=>h()}},[u,h,t,o]);return(0,n.jsx)(l.Provider,{value:m,children:a})}function c(){let e=(0,s.useContext)(l);if(!e)throw Error("useBrowserAuth must be used inside BrowserAuthProvider");return e}function u(e){let{children:a,role:t="user"}=e,l=c(),o=(0,i.usePathname)(),u=(0,i.useRouter)(),d="ready"===l.status&&l.authRequired&&!l.user;return((0,s.useEffect)(()=>{if(d){let e=(0,r.M6)(window.location,o||"/create");u.replace("/auth/login?next=".concat(encodeURIComponent(e)))}},[d,o,u]),"loading"===l.status||d)?(0,n.jsx)(h,{message:"正在确认登录状态…"}):"error"===l.status?(0,n.jsx)(h,{message:l.error||"无法读取认证状态",actionLabel:"重试",onAction:()=>void l.refresh()}):("admin"!==t||l.isAdmin)&&("super"!==t||l.isSuperAdmin)?(0,n.jsx)(n.Fragment,{children:a}):(0,n.jsx)(h,{message:"当前账号无权访问此页面。"})}function d(e){let{to:a,forwardNext:t=!1}=e;return(0,s.useEffect)(()=>{let e=t?new URLSearchParams(window.location.search).get("next"):null,n=e?"".concat(a,"?next=").concat(encodeURIComponent(e)):a;window.location.replace(n)},[t,a]),(0,n.jsx)(h,{message:"正在跳转…"})}function h(e){let{message:a,actionLabel:t,onAction:s}=e;return(0,n.jsxs)("section",{className:"panel",children:[(0,n.jsx)("p",{className:"muted",children:a}),t&&s?(0,n.jsx)("button",{className:"button",type:"button",onClick:s,children:t}):null]})}},5299:(e,a,t)=>{"use strict";t.d(a,{A:()=>n});let n=(0,t(1847).A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},6006:(e,a,t)=>{"use strict";t.r(a),t.d(a,{default:()=>g});var n=t(5155),s=t(2115),i=t(6907),r=t(1847);let l=(0,r.A)("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);var o=t(6191),c=t(8514),u=t(9559),d=t(1360);let h=(0,r.A)("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);var m=t(5299);function p(){let[e,a]=(0,s.useState)(""),[t,i]=(0,s.useState)(""),[r,l]=(0,s.useStateLine truncated
|
||||
Reference in new issue
Block a user