Errant logs

This commit is contained in:
Kilian committed 2024-07-29 00:43:12 +02:00
1 parent 7d92daeccd
commit 2008888a16
6 files changed
+3 -6

No files matched your search

-1
View File
@@ -1 +0,0 @@
import{j as e,M as Pe,a as z,T as w,u as Y,b as ee,D as N,c as U,G as v,d as We,e as te,B as P,f as ne,g as A,C as Q,h as E,L as M,A as Qe,i as we,I as Z,k as He,l as B,P as _,m as Ke,n as Ge,o as Fe,S as W,p as Ee,q as Ae,r as Ve,s as Te,t as De,v as Je,w as pe,x as Ze,y as Xe,z as Ye,E as et,F as tt,H as nt,J as rt}from"./mui-53GMXZgr.js";import{u as H,a as K,b as je,c as ae,d as st,e as at,L as R,f as ot,O as it,g as ct,h as G,q as oe,i as fe,j as X,r as me,k as lt,R as ut,Q as dt,l as ht}from"./tanstack-ZGp-Rrdw.js";import{c as mt,r as j}from"./react-C_FdcE2X.js";import{i as J,B as xt,a as gt,b as pt,u as $,t as C,T as jt}from"./i18n-DyW0LrNj.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"]'))c(r);new MutationObserver(r=>{for(const d of r)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function i(r){const d={};return r.integrity&&(d.integrity=r.integrity),r.referrerPolicy&&(d.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?d.credentials="include":r.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function c(r){if(r.ep)return;r.ep=!0;const d=i(r);fetch(r.href,d)}})();var xe={},be=mt;xe.createRoot=be.createRoot,xe.hydrateRoot=be.hydrateRoot;const k=new Map;function ft(t,n){const i=n==null?void 0:n.serializer,[c]=j.useState(n==null?void 0:n.defaultValue);return yt(t,c,n==null?void 0:n.storageSync,i==null?void 0:i.parse,i==null?void 0:i.stringify)}function yt(t,n,i=!0,c=vt,r=JSON.stringify){const d=j.useRef({string:null,parsed:void 0}),h=j.useSyncExternalStore(j.useCallback(o=>{const g=u=>{t===u&&o()};return ge.add(g),()=>{ge.delete(g)}},[t]),()=>{var o;const g=(o=se(()=>localStorage.getItem(t)))!==null&&o!==void 0?o:null;if(k.has(t))d.current.parsed=k.get(t);else if(g!==d.current.string){let u;try{u=g===null?n:c(g)}catch{u=n}d.current.parsed=u}return d.current.string=g,g===null&&n!==void 0&&se(()=>{const u=r(n);localStorage.setItem(t,u),d.current={string:u,parsed:n}}),d.current.parsed},()=>n),s=j.useCallback(o=>{const g=o instanceof Function?o(d.current.parsed):o;try{localStorage.setItem(t,r(g)),k.delete(t)}catch{k.set(t,g)}de(t)},[t,r]);return j.useEffect(()=>{if(!i)return;const o=g=>{g.storageArea===se(()=>localStorage)&&g.key===t&&de(t)};return window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[t,i]),j.useMemo(()=>[h,s,{isPersistent:h===n||!k.has(t),removeItem(){se(()=>localStorage.removeItem(t)),k.delete(t),de(t)}}],[t,s,h,n])}const ge=new Set;function de(t){for(const n of[...ge])n(t)}function vt(t){return t==="undefined"?void 0:JSON.parse(t)}function se(t){try{return t()}catch{}}const he=15,Ct=3,O="https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/",Ue=j.createContext({hasAuth:!1,currentSession:[void 0,void 0]}),F=()=>{const{hasAuth:t,authenticatedUser:n,currentSession:i,logIn:c,logOut:r,posts:d,newPost:h,updatePost:s,deletePost:o,user:g,createUser:u,updateUser:a,updateUserImage:l,userPosts:m}=j.useContext(Ue);if(c&&r&&d&&h&&s&&o&&g&&u&&a&&l&&m)return{hasAuth:t,authenticatedUser:n,currentSession:i,logIn:c,logOut:r,posts:d,newPost:h,updatePost:s,deletePost:o,user:g,createUser:u,updateUser:a,updateUserImage:l,userPosts:m};throw new Error("Couldn't find context. Is your component inside an ApiProvider?")},wt=({children:t})=>{const[n,i]=j.useState(!1),[c,r]=j.useState(),[d,h]=ft("egb_session",{defaultValue:[void 0,void 0]}),s=j.useRef();j.useEffect(()=>{d[0]&&!s.current&&(s.current=d[0],Ce())},[d]);const o=async(p,f)=>{const{user:y,token:S,refreshToken:Ne}=await(await ye("login",{email:p,password:f})).json();r(y),h([S,Ne]),i(!0),s.current=S},g=async()=>{try{return s.current?await(await T(()=>le("logout"))).json():!0}catch{return!1}finally{r(void 0),h([void 0,void 0]),i(!1),s.current=void 0}},u=async p=>{const f=`posts?p=${p??0}&l=${he}`;return n?await(await T(()=>ue(f))).json():await(await _e(f)).json()},a=async p=>await(await T(()=>le(`posts?l=${he}`,p))).json(),l=async(p,f)=>await(await T(()=>ve(`posts/${f}`,p))).json(),m=async p=>await(await T(()=>ze(`posts/${p}?l=${he}`))).json(),x=async p=>await(await T(()=>ue(`users/${p??(c==null?void 0:c.id)}`))).json(),b=async p=>await(await ye("register",p)).json(),L=async(p,f)=>{const y=await(await T(()=>ve(`users/${f??"self"}`,p))).json();return r(y),y},re=async(p,f)=>{const y=new FormData;p.image&&y.append("image",p.image),!p.image&&p.predefined&&y.append("predefined",p.predefined);const S=await(await T(()=>Be(`users/${f??"self"}/image`,y))).json();return r(S),S},V=async p=>await(await T(()=>ue(`users/${p}/posts?l=${Ct}&s=desc`))).json(),ye=async(p,f,y)=>{const S=await fetch(`${O}${p}`,{mode:"cors",method:"post",headers:y,body:JSON.stringify(f)});if(S.ok)return S;throw await S.json()},le=async(p,f,y)=>{const S=await fetch(`${O}${p}`,{mode:"corLine truncated
+1
View File
@@ -0,0 +1 @@
import{j as e,M as Pe,a as z,T as w,u as Y,b as ee,D as N,c as U,G as v,d as We,e as te,B as P,f as ne,g as A,C as Q,h as E,L as M,A as Qe,i as we,I as Z,k as He,l as B,P as _,m as Ke,n as Ge,o as Fe,S as W,p as Ee,q as Ae,r as Ve,s as Te,t as De,v as Je,w as ge,x as Ze,y as Xe,z as Ye,E as et,F as tt,H as nt,J as rt}from"./mui-53GMXZgr.js";import{u as H,a as K,b as je,c as ae,d as st,e as at,L as R,f as ot,O as it,g as ct,h as G,q as oe,i as fe,j as X,r as me,k as lt,R as ut,Q as dt,l as ht}from"./tanstack-ZGp-Rrdw.js";import{c as mt,r as j}from"./react-C_FdcE2X.js";import{i as J,B as xt,a as pt,b as gt,u as $,t as C,T as jt}from"./i18n-DyW0LrNj.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"]'))c(r);new MutationObserver(r=>{for(const d of r)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function i(r){const d={};return r.integrity&&(d.integrity=r.integrity),r.referrerPolicy&&(d.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?d.credentials="include":r.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function c(r){if(r.ep)return;r.ep=!0;const d=i(r);fetch(r.href,d)}})();var xe={},be=mt;xe.createRoot=be.createRoot,xe.hydrateRoot=be.hydrateRoot;const O=new Map;function ft(t,n){const i=n==null?void 0:n.serializer,[c]=j.useState(n==null?void 0:n.defaultValue);return yt(t,c,n==null?void 0:n.storageSync,i==null?void 0:i.parse,i==null?void 0:i.stringify)}function yt(t,n,i=!0,c=vt,r=JSON.stringify){const d=j.useRef({string:null,parsed:void 0}),h=j.useSyncExternalStore(j.useCallback(o=>{const p=u=>{t===u&&o()};return pe.add(p),()=>{pe.delete(p)}},[t]),()=>{var o;const p=(o=se(()=>localStorage.getItem(t)))!==null&&o!==void 0?o:null;if(O.has(t))d.current.parsed=O.get(t);else if(p!==d.current.string){let u;try{u=p===null?n:c(p)}catch{u=n}d.current.parsed=u}return d.current.string=p,p===null&&n!==void 0&&se(()=>{const u=r(n);localStorage.setItem(t,u),d.current={string:u,parsed:n}}),d.current.parsed},()=>n),s=j.useCallback(o=>{const p=o instanceof Function?o(d.current.parsed):o;try{localStorage.setItem(t,r(p)),O.delete(t)}catch{O.set(t,p)}de(t)},[t,r]);return j.useEffect(()=>{if(!i)return;const o=p=>{p.storageArea===se(()=>localStorage)&&p.key===t&&de(t)};return window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[t,i]),j.useMemo(()=>[h,s,{isPersistent:h===n||!O.has(t),removeItem(){se(()=>localStorage.removeItem(t)),O.delete(t),de(t)}}],[t,s,h,n])}const pe=new Set;function de(t){for(const n of[...pe])n(t)}function vt(t){return t==="undefined"?void 0:JSON.parse(t)}function se(t){try{return t()}catch{}}const he=15,Ct=3,q="https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/",Ue=j.createContext({hasAuth:!1,currentSession:[void 0,void 0]}),F=()=>{const{hasAuth:t,authenticatedUser:n,currentSession:i,logIn:c,logOut:r,posts:d,newPost:h,updatePost:s,deletePost:o,user:p,createUser:u,updateUser:a,updateUserImage:l,userPosts:m}=j.useContext(Ue);if(c&&r&&d&&h&&s&&o&&p&&u&&a&&l&&m)return{hasAuth:t,authenticatedUser:n,currentSession:i,logIn:c,logOut:r,posts:d,newPost:h,updatePost:s,deletePost:o,user:p,createUser:u,updateUser:a,updateUserImage:l,userPosts:m};throw new Error("Couldn't find context. Is your component inside an ApiProvider?")},wt=({children:t})=>{const[n,i]=j.useState(!1),[c,r]=j.useState(),[d,h]=ft("egb_session",{defaultValue:[void 0,void 0]}),s=j.useRef();j.useEffect(()=>{d[0]&&!s.current&&(s.current=d[0],Ce())},[d]);const o=async(g,f)=>{const{user:y,token:S,refreshToken:Ne}=await(await ye("login",{email:g,password:f})).json();r(y),h([S,Ne]),i(!0),s.current=S},p=async()=>{try{return s.current?await(await T(()=>le("logout"))).json():!0}catch{return!1}finally{r(void 0),h([void 0,void 0]),i(!1),s.current=void 0}},u=async g=>{const f=`posts?p=${g??0}&l=${he}`;return n?await(await T(()=>ue(f))).json():await(await _e(f)).json()},a=async g=>await(await T(()=>le(`posts?l=${he}`,g))).json(),l=async(g,f)=>await(await T(()=>ve(`posts/${f}`,g))).json(),m=async g=>await(await T(()=>ze(`posts/${g}?l=${he}`))).json(),x=async g=>await(await T(()=>ue(`users/${g??(c==null?void 0:c.id)}`))).json(),b=async g=>await(await ye("register",g)).json(),L=async(g,f)=>{const y=await(await T(()=>ve(`users/${f??"self"}`,g))).json();return r(y),y},re=async(g,f)=>{const y=new FormData;g.image&&y.append("image",g.image),!g.image&&g.predefined&&y.append("predefined",g.predefined);const S=await(await T(()=>Be(`users/${f??"self"}/image`,y))).json();return r(S),S},V=async g=>await(await T(()=>ue(`users/${g}/posts?l=${Ct}&s=desc`))).json(),ye=async(g,f,y)=>{const S=await fetch(`${q}${g}`,{mode:"cors",method:"post",headers:y,body:JSON.stringify(f)});if(S.ok)return S;throw await S.json()},le=async(g,f,y)=>{const S=await fetch(`${q}${g}`,{mode:"corLine truncated