dsql-admin/dsql-app/.local_dist/server/pages/admin/[user_id]/databases.js
Benjamin Toby 81cf010cb5 Updates
2025-01-14 16:27:08 +01:00

1 line
3.3 KiB
JavaScript

"use strict";(()=>{var e={};e.id=2564,e.ids=[2564],e.modules={25316:(e,t,s)=>{s.r(t),s.d(t,{config:()=>w,default:()=>q,getServerSideProps:()=>D,getStaticPaths:()=>A,getStaticProps:()=>M,reportWebVitals:()=>E,routeModule:()=>W,unstable_getServerProps:()=>N,unstable_getServerSideProps:()=>R,unstable_getStaticParams:()=>F,unstable_getStaticPaths:()=>y,unstable_getStaticProps:()=>C});var a={};s.r(a),s.d(a,{DatabasesContext:()=>P,default:()=>v,getServerSideProps:()=>_});var r=s(63865),i=s(9455),n=s(30671),d=s(5583),l=s(19796),u=s(8732),o=s(82015),c=s.n(o),p=s(25562),x=s(92702),m=s(53926),g=s(66485),b=s(56331),h=s(67274);function S(){let{databases:e,setTargetDatabase:t,user:s}=c().useContext(P);return(0,u.jsxs)(c().Fragment,{children:[(0,u.jsxs)("div",{className:"flex-col items-start gap-0 w-full",children:[(0,u.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,u.jsx)("h1",{className:"text-3xl m-0",children:"Databases"}),(0,u.jsxs)("a",{href:`/admin/${s?.id}/databases/add-database`,className:"button flex items-center gap-2",children:[(0,u.jsx)("span",{className:"symbol",children:"+"}),(0,u.jsx)("span",{children:"Add Database"})]})]}),(0,u.jsx)(m.A,{user:s})]}),s?.verification_status?.toString().match(/1/)?(0,u.jsxs)(c().Fragment,{children:[(0,u.jsx)(b.A,{databases:e,setTargetDatabase:t,user:s}),(0,u.jsx)(h.A,{user:s})]}):(0,u.jsx)(g.A,{})]})}var j=s(70355),f=s(71934);let P=c().createContext({});function v({user:e,databases:t}){let s=(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("title",{children:"Databases | Datasquirel"}),(0,u.jsx)("meta",{name:"description",content:"Welcome to your data app"})]}),[a,r]=c().useState();return(0,u.jsx)(P.Provider,{value:{user:e,databases:t,targetDatabase:a,setTargetDatabase:r},children:(0,u.jsxs)(c().Fragment,{children:[(0,u.jsx)(p.A,{head:s,user:e,children:(0,u.jsx)(S,{})}),(0,u.jsx)(j.A,{targetDatabase:a})]})})}async function _({req:e,res:t,query:s}){let a=await (0,x.A)(e,t);if(!a?.logged_in_status)return{redirect:{destination:"/login",permanent:!1}};let r=await (0,f.A)("SELECT * FROM user_databases WHERE user_id=? ORDER BY id DESC",[a.id]);return{props:{user:a,databases:r}}}let q=(0,n.M)(a,"default"),M=(0,n.M)(a,"getStaticProps"),A=(0,n.M)(a,"getStaticPaths"),D=(0,n.M)(a,"getServerSideProps"),w=(0,n.M)(a,"config"),E=(0,n.M)(a,"reportWebVitals"),C=(0,n.M)(a,"unstable_getStaticProps"),y=(0,n.M)(a,"unstable_getStaticPaths"),F=(0,n.M)(a,"unstable_getStaticParams"),N=(0,n.M)(a,"unstable_getServerProps"),R=(0,n.M)(a,"unstable_getServerSideProps"),W=new r.PagesRouteModule({definition:{kind:i.A.PAGES,page:"/admin/[user_id]/databases",pathname:"/admin/[user_id]/databases",bundlePath:"",filename:""},components:{App:l.default,Document:d.default},userland:a})},13893:e=>{e.exports=require("@moduletrace/datasquirel/dist/client/fetch")},39908:e=>{e.exports=require("@moduletrace/datasquirel/dist/users/user-auth")},40361:e=>{e.exports=require("next/dist/compiled/next-server/pages.runtime.prod.js")},27912:e=>{e.exports=require("next/head")},82015:e=>{e.exports=require("react")},22326:e=>{e.exports=require("react-dom")},8732:e=>{e.exports=require("react/jsx-runtime")},9973:e=>{e.exports=require("serverless-mysql")},33873:e=>{e.exports=require("path")}};var t=require("../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),a=t.X(0,[883,9821,9796,5392,5771],()=>s(25316));module.exports=a})();