Image 2
This commit is contained in:
1 parent
eb3516bfb2
commit
a3ec9ae318
7 files changed
+41
-19
No files matched your search
Vendored
+1
@@ -0,0 +1 @@
|
||||
import{j as e,M as le,a as $,T as y,B as w,b as P,c as C,A as Ce,d as re,L as U,C as M,I as O,e as be,f as D,P as T,g as we,u as Se,h as ce,i as X,k as Z,D as Q,l as W,m as E,n as K,o as ue,p as Pe,q as de,r as he,s as Ee,S as q,t as Fe,G as v,v as J,w as Ae,x as ke,y as De,z as Te,F as $e,E as Ie,H as Ue}from"./mui-CxHUbSMi.js";import{u as Y,a as R,b as H,c as Le,d as Oe,L as A,e as qe,O as Me,f as Re,r as N,g as B,h as z,q as ee,i as te,j as ne,Q as Be,k as ze,l as Ne,R as Qe,m as We}from"./tanstack-xmxrKlZO.js";import{c as Ke,r as f}from"./react-DXd9vB-a.js";import{i as L,B as He,a as Ve,b as _e,u as F,t as h}from"./i18n-DJgSTqOl.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))a(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const r of i.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&a(r)}).observe(document,{childList:!0,subtree:!0});function o(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function a(s){if(s.ep)return;s.ep=!0;const i=o(s);fetch(s.href,i)}})();var G={},ae=Ke;G.createRoot=ae.createRoot,G.hydrateRoot=ae.hydrateRoot;const _=15,S="https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/";let oe;class Ge{constructor(){if(this.userListeners=[],this.hasAuth=()=>this.token!==void 0,this.isAdmin=()=>{var n;return this.hasAuth()&&((n=this.self)==null?void 0:n.isAdmin)},this.getAuthenticatedUser=()=>this.self,this.getCurrentSession=()=>[this.token,this.refreshToken],this.subscribeToAuthenticatedUser=n=>(this.userListeners.push(n),()=>{this.userListeners=this.userListeners.filter(o=>o!==n)}),this.logIn=async(n,o)=>{const{user:a,token:s}=await(await this.post("login",{email:n,password:o})).json();this.self=a,this.token=s,this.userListeners.forEach(i=>i(a))},this.logOut=async()=>{try{return await(await this.postAuth("logout")).json()}catch{return!1}finally{this.self=void 0,this.token=void 0,this.userListeners.forEach(n=>n())}},this.posts=async n=>{const o=`posts?p=${n??0}&l=${_}`;return this.token?await(await this.getAuth(o)).json():await(await this.get(o)).json()},this.deletePost=async n=>await(await this.delete(`posts/${n}?l=${_}`)).json(),this.user=async n=>{var o;return await(await this.getAuth(`users/${n??((o=this.self)==null?void 0:o.id)}`)).json()},this.updateUser=async(n,o)=>{const a=await(await this.patch(`users/${o??"self"}`,n)).json();return this.self=a,this.userListeners.forEach(s=>s(a)),a},this.updateUserImage=async(n,o)=>{const a=new FormData;n.image&&a.append("image",n.image),!n.image&&n.predefined&&a.append("predefined",n.predefined);const s=await(await this.postAuthRaw(`users/${o??"self"}/image`,a)).json();return this.self=s,this.userListeners.forEach(i=>i(s)),s},this.newPost=async n=>await(await this.postAuth(`posts?l=${_}`,{...n})).json(),this.updatePost=async(n,o)=>await(await this.patch(`posts/${o}`,n)).json(),this.post=async(n,o,a)=>{const s=await fetch(`${S}${n}`,{mode:"cors",method:"post",headers:a,body:JSON.stringify(o)});if(s.ok)return s;throw await s.json()},this.postAuth=async(n,o,a)=>{const s=await fetch(`${S}${n}`,{mode:"cors",method:"post",headers:{token:this.token??"",...a},body:JSON.stringify(o)});if(s.ok)return s;throw await s.json()},this.postAuthRaw=async(n,o,a)=>{const s=await fetch(`${S}${n}`,{mode:"cors",method:"post",headers:{token:this.token??"",...a},body:o});if(s.ok)return s;throw await s.json()},this.get=async(n,o)=>{const a=await fetch(`${S}${n}`,{mode:"cors",method:"get",headers:o});if(a.ok)return a;throw await a.json()},this.getAuth=async(n,o)=>{const a=await fetch(`${S}${n}`,{mode:"cors",method:"get",headers:{token:this.token??"",...o}});if(a.ok)return a;throw await a.json()},this.delete=async(n,o)=>{const a=await fetch(`${S}${n}`,{mode:"cors",method:"delete",headers:{token:this.token??"",...o}});if(a.ok)return a;throw await a.json()},this.patch=async(n,o,a)=>{const s=await fetch(`${S}${n}`,{mode:"cors",method:"patch",headers:{token:this.token??"",...a},body:JSON.stringify(o)});if(s.ok)return s;throw await s.json()},oe)throw new Error("New instance cannot be created!!");oe=this}}const m=new Ge;var k=(t=>(t.NOT_FOUND="NotFound",t.UNAUTHORIZED="Unauthorized",t.FAILED_UPDATE="FailedUpdate",t.MISSING_FIELD="MissingField",t))(k||{});L.use(He).use(Ve).use(_e).init({fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1},backend:{loadPath:"/phpCourse/exam/dist/locales/{{lng}}/{{ns}}.json"}});const Xe=({anchorEl:t,handleClose:n})=>e.jsxs(le,{anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:!!t,onClose:n,sx:{"& .MuiMenu-paper":{minWidth:"240px"}},children:[e.jsx($,{selected:L.language==="en",onClick:()=>{Line truncated
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
import{j as e,M as le,a as q,T as y,B as w,b as P,c as C,A as Ce,d as re,L as T,C as L,I as O,e as be,f as D,P as $,g as we,u as Se,h as ce,i as X,k as Z,D as Q,l as W,m as F,n as K,o as ue,p as Pe,q as de,r as he,s as Fe,S as M,t as Ae,G as v,v as J,w as Ee,x as ke,y as De,z as $e,F as Ie,E as Te,H as Ue}from"./mui-CxHUbSMi.js";import{u as Y,a as R,b as H,c as Oe,d as qe,L as E,e as Me,O as Le,f as Re,r as N,g as B,h as z,q as ee,i as te,j as ne,Q as Be,k as ze,l as Ne,R as Qe,m as We}from"./tanstack-xmxrKlZO.js";import{c as Ke,r as f}from"./react-DXd9vB-a.js";import{i as U,B as He,a as Ve,b as _e,u as A,t as m}from"./i18n-DJgSTqOl.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&a(s)}).observe(document,{childList:!0,subtree:!0});function o(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 a(r){if(r.ep)return;r.ep=!0;const i=o(r);fetch(r.href,i)}})();var G={},ae=Ke;G.createRoot=ae.createRoot,G.hydrateRoot=ae.hydrateRoot;const _=15,S="https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/";let oe;class Ge{constructor(){if(this.hasAuth=()=>this.token!==void 0,this.isAdmin=()=>{var n;return this.hasAuth()&&((n=this.self)==null?void 0:n.isAdmin)},this.getAuthenticatedUser=()=>this.self,this.getCurrentSession=()=>[this.token,this.refreshToken],this.logIn=async(n,o)=>{const{user:a,token:r}=await(await this.post("login",{email:n,password:o})).json();this.self=a,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 n=>{const o=`posts?p=${n??0}&l=${_}`;return this.token?await(await this.getAuth(o)).json():await(await this.get(o)).json()},this.deletePost=async n=>await(await this.delete(`posts/${n}?l=${_}`)).json(),this.user=async n=>{var o;return await(await this.getAuth(`users/${n??((o=this.self)==null?void 0:o.id)}`)).json()},this.updateUser=async(n,o)=>{const a=await(await this.patch(`users/${o??"self"}`,n)).json();return this.self=a,a},this.updateUserImage=async(n,o)=>{const a=new FormData;n.image&&a.append("image",n.image),!n.image&&n.predefined&&a.append("predefined",n.predefined);const r=await(await this.postAuthRaw(`users/${o??"self"}/image`,a)).json();return this.self=r,r},this.newPost=async n=>await(await this.postAuth(`posts?l=${_}`,{...n})).json(),this.updatePost=async(n,o)=>await(await this.patch(`posts/${o}`,n)).json(),this.post=async(n,o,a)=>{const r=await fetch(`${S}${n}`,{mode:"cors",method:"post",headers:a,body:JSON.stringify(o)});if(r.ok)return r;throw await r.json()},this.postAuth=async(n,o,a)=>{const r=await fetch(`${S}${n}`,{mode:"cors",method:"post",headers:{token:this.token??"",...a},body:JSON.stringify(o)});if(r.ok)return r;throw await r.json()},this.postAuthRaw=async(n,o,a)=>{const r=await fetch(`${S}${n}`,{mode:"cors",method:"post",headers:{token:this.token??"",...a},body:o});if(r.ok)return r;throw await r.json()},this.get=async(n,o)=>{const a=await fetch(`${S}${n}`,{mode:"cors",method:"get",headers:o});if(a.ok)return a;throw await a.json()},this.getAuth=async(n,o)=>{const a=await fetch(`${S}${n}`,{mode:"cors",method:"get",headers:{token:this.token??"",...o}});if(a.ok)return a;throw await a.json()},this.delete=async(n,o)=>{const a=await fetch(`${S}${n}`,{mode:"cors",method:"delete",headers:{token:this.token??"",...o}});if(a.ok)return a;throw await a.json()},this.patch=async(n,o,a)=>{const r=await fetch(`${S}${n}`,{mode:"cors",method:"patch",headers:{token:this.token??"",...a},body:JSON.stringify(o)});if(r.ok)return r;throw await r.json()},oe)throw new Error("New instance cannot be created!!");oe=this}}const g=new Ge;var k=(t=>(t.NOT_FOUND="NotFound",t.UNAUTHORIZED="Unauthorized",t.FAILED_UPDATE="FailedUpdate",t.MISSING_FIELD="MissingField",t))(k||{});U.use(He).use(Ve).use(_e).init({fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1},backend:{loadPath:"/phpCourse/exam/dist/locales/{{lng}}/{{ns}}.json"}});const Xe=({anchorEl:t,handleClose:n})=>e.jsxs(le,{anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:!!t,onClose:n,sx:{"& .MuiMenu-paper":{minWidth:"240px"}},children:[e.jsx(q,{selected:U.language==="en",onClick:()=>{U.changeLanguage("en"),n()},children:"English"},"de"),e.jsx(q,{selected:U.language==="de",onClick:()=>{U.changeLanguage("de"),n()},children:"Deutsch"},"en")]});var b=(t=>(t.INDEX="/",t.PROFILE="/profile",t))(b||{});const I=({error:t,context:n,color:o="error.main"})=>{const{t:a}=A();if(consolLine truncated
|
||||
Reference in new issue
Block a user