PageSourceSearch

https://app.snapto.ai/assets/SwitchUser-C5v3DR8h.js

js snapto.ai collected 2026-10-05 15:07:15 UTC 1,262 bytes, 1 lines download raw bytes

1import{J as x,r as i,D as j,ac as y,C as w,q as k,p as t,L as D,ag as S,w as T,a5 as U,B as N,N as l,y as R,a$ as v,aq as I,b0 as C}from"./index-C9IH3k-2.js";import{R as a}from"./InfoCircleOutlined-B7sKwm1k.js";import{R as E}from"./UserSwitchOutlined--6-IKbBL.js";const O=()=>{const{token:u}=x.useToken(),[s,o]=i.useState(""),[d,r]=i.useState(!1),p=j(),m=y().pathname,n=w(),f=k(e=>e?.jwtTokenDecodedData?.roleType),c=async()=>{if(!s.trim()){l.error({content:"Please enter a username",icon:t.jsx(a,{style:{color:"red"}})});return}r(!0);try{const e=await R("/api/v1/admin/getTokenForUser",JSON.stringify({username:s}));if(e.status===200){const g={userName:s,token:e.data.token,authState:!0};v(g);const h=I(e.data.token);await C(p,m,n,h),o(""),n("/")}}catch(e){l.error({content:e.response?.data?.message||e.message||"Failed to switch user",icon:t.jsx(a,{style:{color:"red"}})})}finally{r(!1)}};return f!=="ADMIN"?null:t.jsxs(D,{align:"center",gap:8,children:[t.jsx(S,{prefix:t.jsx(U,{}),placeholder:"Enter Username",value:s,onChange:e=>o(e.target.value),onPressEnter:c,suffix:t.jsx(T,{title:"Username to switch to",children:t.jsx(a,{style:{color:u.colorTextTertiary}})})}),t.jsx(N,{icon:t.jsx(E,{}),onClick:c,loading:d,children:"Change"})]})};export{O as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.