Missign translation

This commit is contained in:
Kilian committed 2024-07-27 01:40:45 +02:00
1 parent 581cacb636
commit 683b6020b7
12 files changed
+55 -20

No files matched your search

-1
View File
@@ -1 +0,0 @@
import{j as e,M as V,a as D,T as d,B as E,b as U,c as x,A as ge,d as W,L as v,C as X,I,e as pe,f as A,P,g as xe,u as je,h as Z,i as fe,k as J,l as _,D as Y,m as ee,n as L,o as ye,p as te,S as F,q as Ce,G as C,r as we,s as ve,t as be,v as Ae}from"./mui-BZej3Yg3.js";import{u as M,a as se,b as Pe,c as ke,L as y,d as Ee,O as Fe,e as De,r as S,f as ne,g as re,q,h as N,i as B,Q as Se,j as $e,k as Oe,R as Te,l as Ie}from"./tanstack-DeUNQvBN.js";import{c as Ue,r as p}from"./react-DXd9vB-a.js";import{i as b,B as Le,a as Re,b as Me,u as w,t as m}from"./i18n-DJgSTqOl.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const n of i.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&o(n)}).observe(document,{childList:!0,subtree:!0});function a(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(r){if(r.ep)return;r.ep=!0;const i=a(r);fetch(r.href,i)}})();var R={},H=Ue;R.createRoot=H.createRoot,R.hydrateRoot=H.hydrateRoot;const f="https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/";let K;class qe{constructor(){if(this.hasAuth=()=>this.token!==void 0,this.isAdmin=()=>{var s;return this.hasAuth()&&((s=this.self)==null?void 0:s.isAdmin)},this.getAuthenticatedUser=()=>this.self,this.getCurrentSession=()=>[this.token,this.refreshToken],this.logIn=async(s,a)=>{const{user:o,token:r}=await(await this.post("login",{email:s,password:a})).json();this.self=o,this.token=r},this.logOut=async()=>{try{return await(await this.postAuth("logout")).json()}catch{return!1}finally{this.self=void 0,this.token=void 0}},this.posts=async s=>{const a=`posts?p=${s??0}&l=9`;return this.token?await(await this.getAuth(a)).json():await(await this.get(a)).json()},this.deletePost=async s=>await(await this.delete(`posts/${s}`)).json(),this.user=async s=>{var a;return await(await this.getAuth(`users/${s??((a=this.self)==null?void 0:a.id)}`)).json()},this.updateUser=async(s,a)=>await(await this.patch(`users/${a??"self"}`,s)).json(),this.post=async(s,a,o)=>{const r=await fetch(`${f}${s}`,{mode:"cors",method:"post",headers:o,body:JSON.stringify(a)});if(r.ok)return r;throw await r.json()},this.postAuth=async(s,a,o)=>{const r=await fetch(`${f}${s}`,{mode:"cors",method:"post",headers:{token:this.token??"",...o},body:JSON.stringify(a)});if(r.ok)return r;throw await r.json()},this.get=async(s,a)=>{const o=await fetch(`${f}${s}`,{mode:"cors",method:"get",headers:a});if(o.ok)return o;throw await o.json()},this.getAuth=async(s,a)=>{const o=await fetch(`${f}${s}`,{mode:"cors",method:"get",headers:{token:this.token??"",...a}});if(o.ok)return o;throw await o.json()},this.delete=async(s,a)=>{const o=await fetch(`${f}${s}`,{mode:"cors",method:"delete",headers:{token:this.token??"",...a}});if(o.ok)return o;throw await o.json()},this.patch=async(s,a,o)=>{const r=await fetch(`${f}${s}`,{mode:"cors",method:"patch",headers:{token:this.token??"",...o},body:JSON.stringify(a)});if(r.ok)return r;throw await r.json()},K)throw new Error("New instance cannot be created!!");K=this}}const l=new qe;var k=(t=>(t.NOT_FOUND="NotFound",t.UNAUTHORIZED="Unauthorized",t.FAILEDUPDATE="FailedUpdate",t))(k||{});b.use(Le).use(Re).use(Me).init({fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1},backend:{loadPath:"/phpCourse/exam/dist/locales/{{lng}}/{{ns}}.json"}});const Ne=({anchorEl:t,handleClose:s})=>e.jsxs(V,{anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:!!t,onClose:s,sx:{"& .MuiMenu-paper":{minWidth:"240px"}},children:[e.jsx(D,{selected:b.language==="en",onClick:()=>{b.changeLanguage("en"),s()},children:"English"},"de"),e.jsx(D,{selected:b.language==="de",onClick:()=>{b.changeLanguage("de"),s()},children:"Deutsch"},"en")]});var g=(t=>(t.INDEX="/",t.PROFILE="/profile",t))(g||{});const Q=({error:t,context:s})=>{const{t:a}=w();if(!t)return null;if(t.code)switch(t.code){case k.NOT_FOUND:return e.jsx(d,{color:"error.main",children:a(t.code,{context:`${t.entity}:${s}`})});case k.UNAUTHORIZED:return e.jsx(d,{color:"error.main",children:a(t.code,{context:s})});case k.FAILEDUPDATE:return t.fields.map(o=>e.jsx(d,{color:"error.main",children:a(t.code,{context:s,name:a(o)})},`error_${o}`))}return e.jsx(d,{color:"error.main",children:a((t==null?void 0:t.message)??"Unknown",{context:s})})},Be=({handleClose:t})=>{const[s,a]=p.useState(),{t:o}=w(),r=M(),i=se({defaultValues:{email:"",password:""},onSubmit:async({value:n})=>{try{await l.logIn(n.email,n.password),r.invalidate(),t()}catch(u){a(u)}}});return e.jsx("form",{onSubmit:n=>{n.preventDefault(),n.stopPropagation(),i.handleSubmit()},onKeyDoLine truncated
+1
View File
@@ -0,0 +1 @@
import{j as e,M as X,a as $,T as d,B as F,b as L,c as x,A as ge,d as H,L as b,C as Z,I as U,e as pe,f as P,P as k,g as xe,u as je,h as J,i as fe,k as _,l as Y,D as ee,m as te,n as R,o as ye,p as se,S as D,q as Ce,G as C,r as we,s as ve,t as be,v as Ae}from"./mui-BZej3Yg3.js";import{u as q,a as ne,b as Pe,c as ke,L as y,d as Ee,O as Fe,e as De,r as T,f as re,g as oe,q as N,h as B,i as Q,Q as Se,j as $e,k as Te,R as Oe,l as Ie}from"./tanstack-DeUNQvBN.js";import{c as Ue,r as g}from"./react-DXd9vB-a.js";import{i as A,B as Le,a as Re,b as Me,u as w,t as m}from"./i18n-DJgSTqOl.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))o(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const r of i.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&o(r)}).observe(document,{childList:!0,subtree:!0});function a(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(n){if(n.ep)return;n.ep=!0;const i=a(n);fetch(n.href,i)}})();var M={},K=Ue;M.createRoot=K.createRoot,M.hydrateRoot=K.hydrateRoot;const f="https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/";let G;class qe{constructor(){if(this.hasAuth=()=>this.token!==void 0,this.isAdmin=()=>{var s;return this.hasAuth()&&((s=this.self)==null?void 0:s.isAdmin)},this.getAuthenticatedUser=()=>this.self,this.getCurrentSession=()=>[this.token,this.refreshToken],this.logIn=async(s,a)=>{const{user:o,token:n}=await(await this.post("login",{email:s,password:a})).json();this.self=o,this.token=n},this.logOut=async()=>{try{return await(await this.postAuth("logout")).json()}catch{return!1}finally{this.self=void 0,this.token=void 0}},this.posts=async s=>{const a=`posts?p=${s??0}&l=9`;return this.token?await(await this.getAuth(a)).json():await(await this.get(a)).json()},this.deletePost=async s=>await(await this.delete(`posts/${s}`)).json(),this.user=async s=>{var a;return await(await this.getAuth(`users/${s??((a=this.self)==null?void 0:a.id)}`)).json()},this.updateUser=async(s,a)=>await(await this.patch(`users/${a??"self"}`,s)).json(),this.post=async(s,a,o)=>{const n=await fetch(`${f}${s}`,{mode:"cors",method:"post",headers:o,body:JSON.stringify(a)});if(n.ok)return n;throw await n.json()},this.postAuth=async(s,a,o)=>{const n=await fetch(`${f}${s}`,{mode:"cors",method:"post",headers:{token:this.token??"",...o},body:JSON.stringify(a)});if(n.ok)return n;throw await n.json()},this.get=async(s,a)=>{const o=await fetch(`${f}${s}`,{mode:"cors",method:"get",headers:a});if(o.ok)return o;throw await o.json()},this.getAuth=async(s,a)=>{const o=await fetch(`${f}${s}`,{mode:"cors",method:"get",headers:{token:this.token??"",...a}});if(o.ok)return o;throw await o.json()},this.delete=async(s,a)=>{const o=await fetch(`${f}${s}`,{mode:"cors",method:"delete",headers:{token:this.token??"",...a}});if(o.ok)return o;throw await o.json()},this.patch=async(s,a,o)=>{const n=await fetch(`${f}${s}`,{mode:"cors",method:"patch",headers:{token:this.token??"",...o},body:JSON.stringify(a)});if(n.ok)return n;throw await n.json()},G)throw new Error("New instance cannot be created!!");G=this}}const l=new qe;var E=(t=>(t.NOT_FOUND="NotFound",t.UNAUTHORIZED="Unauthorized",t.FAILEDUPDATE="FailedUpdate",t))(E||{});A.use(Le).use(Re).use(Me).init({fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1},backend:{loadPath:"/phpCourse/exam/dist/locales/{{lng}}/{{ns}}.json"}});const Ne=({anchorEl:t,handleClose:s})=>e.jsxs(X,{anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:!!t,onClose:s,sx:{"& .MuiMenu-paper":{minWidth:"240px"}},children:[e.jsx($,{selected:A.language==="en",onClick:()=>{A.changeLanguage("en"),s()},children:"English"},"de"),e.jsx($,{selected:A.language==="de",onClick:()=>{A.changeLanguage("de"),s()},children:"Deutsch"},"en")]});var p=(t=>(t.INDEX="/",t.PROFILE="/profile",t))(p||{});const z=({error:t,context:s,color:a="error.main"})=>{const{t:o}=w();if(!t)return null;if(t.code)switch(t.code){case E.NOT_FOUND:return e.jsx(d,{color:a,children:o(t.code,{context:`${t.entity}:${s}`})});case E.UNAUTHORIZED:return e.jsx(d,{color:a,children:o(t.code,{context:s})});case E.FAILEDUPDATE:return t.fields.map(n=>e.jsx(d,{color:a,children:o(t.code,{context:s,name:o(n)})},`error_${n}`))}return e.jsx(d,{color:a,children:o((t==null?void 0:t.message)??"Unknown",{context:s})})},Be=({handleClose:t})=>{const[s,a]=g.useState(),{t:o}=w(),n=q(),i=ne({defaultValues:{email:"",password:""},onSubmit:async({value:r})=>{try{await l.logIn(r.email,r.password),n.invalidate(),t()}catch(u){a(u)}}});return e.jsx("form",{onSubmit:r=>{r.preventDefault(),r.stopPropagation(),i.handleSubmit()},onKeyDown:r=>{Line truncated