You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
2.9 KiB

var h=Object.defineProperty;var g=(s,t,i)=>t in s?h(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i;var c=(s,t,i)=>g(s,typeof t!="symbol"?t+"":t,i);import{V as v,f as x,y as w,C as b,_ as S,g as p,h as y,i as f,j as l,k as C,m as _,s as $,F as N,x as V}from"./index-BLqts8WY.js";import{Q as D}from"./QuickNav-DgCyvgDx.js";import{i as O,g as A,w as J,x as P,u as E}from"./index-MyY_xqVN.js";import"./index-CsfPLOYu.js";var I=Object.defineProperty,R=Object.getOwnPropertyDescriptor,T=(s,t,i,a)=>{for(var e=a>1?void 0:a?R(t,i):t,n=s.length-1,o;n>=0;n--)(o=s[n])&&(e=(a?o(t,i,e):o(e))||e);return a&&e&&I(t,i,e),e};let u=class extends v{constructor(){super(...arguments);c(this,"$notify");c(this,"accountIdentityStr","null");c(this,"activeDid","");c(this,"apiServer","");c(this,"claimStr","")}async mounted(){var a;const i=await x();if(this.activeDid=i.activeDid||"",this.apiServer=i.apiServer||"",this.claimStr=this.$route.query.claim,this.claimStr)try{const e=JSON.parse(this.claimStr);this.claimStr=JSON.stringify(e,null,2)}catch{}else{const e=this.$route.query.claimJwtId;if(e){const n=O(e)?"/api/claim/byHandle/":"/api/claim/",o=this.apiServer+n+encodeURIComponent(e),m=await A(this.activeDid);try{const r=await this.axios.get(o,{headers:m});if(r.status===200){const d=(a=r.data)==null?void 0:a.claim;d.lastClaimId=J(e),this.claimStr=JSON.stringify(d,null,2)}else throw{message:"Got an error loading that claim.",response:{status:r.status,statusText:r.statusText}}}catch(r){w("Error retrieving claim: "+P(r),!0),this.$notify({group:"alert",type:"danger",title:"Error",text:"Got an error retrieving claim data."},3e3)}}}}async submitClaim(){const i=JSON.parse(this.claimStr),a=await E(i,this.activeDid,this.apiServer,this.axios);a.type==="success"?this.$notify({group:"alert",type:"success",title:"Success",text:"Claim submitted."},5e3):(console.error("Got error submitting the claim:",a),this.$notify({group:"alert",type:"danger",title:"Error",text:"There was a problem submitting the claim."},-1))}};u=T([b({components:{QuickNav:D}})],u);const k={id:"Content",class:"p-6 pb-24 max-w-3xl mx-auto"},B={id:"ViewBreadcrumb",class:"mb-8"},F={class:"text-lg text-center font-light relative px-7"},G={class:"flex"};function Q(s,t,i,a,e,n){const o=p("QuickNav"),m=p("fa");return V(),y(N,null,[f(o),l("section",k,[l("div",B,[l("h1",F,[l("button",{onClick:t[0]||(t[0]=r=>s.$router.go(-1)),class:"text-lg text-center px-2 py-1 absolute -left-2 -top-1"},[f(m,{icon:"chevron-left",class:"fa-fw"})]),t[3]||(t[3]=C(" Raw Claim "))])]),l("div",G,[_(l("textarea",{rows:"20",class:"border-2 w-full","onUpdate:modelValue":t[1]||(t[1]=r=>s.claimStr=r)},null,512),[[$,s.claimStr]])]),l("button",{class:"block w-full text-center text-lg font-bold uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md",onClick:t[2]||(t[2]=r=>s.submitClaim())}," Sign & Send ")])],64)}const z=S(u,[["render",Q]]);export{z as default};