Updates
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import Main from "@/src/components/pages/admin/settings";
|
||||
import { NSQLITE_TURBOCI_ADMIN_USERS } from "@/src/db/types";
|
||||
import defaultAdminProps from "@/src/functions/pages/admin/default-admin-props";
|
||||
import Layout from "@/src/layouts/admin";
|
||||
import NSQLite from "@moduletrace/nsqlite";
|
||||
import { GetServerSideProps } from "next";
|
||||
|
||||
export default function AdminSettings() {
|
||||
@@ -12,5 +14,27 @@ export default function AdminSettings() {
|
||||
}
|
||||
|
||||
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||
return await defaultAdminProps({ ctx });
|
||||
return await defaultAdminProps({
|
||||
ctx,
|
||||
async propsFn({ user }) {
|
||||
if (!user.id) {
|
||||
return `/admin`;
|
||||
}
|
||||
|
||||
const users_res = await NSQLite.select<NSQLITE_TURBOCI_ADMIN_USERS>(
|
||||
{
|
||||
table: "users",
|
||||
targetId: user.id,
|
||||
},
|
||||
);
|
||||
|
||||
if (!users_res.singleRes?.id) {
|
||||
return `/admin/users`;
|
||||
}
|
||||
|
||||
return {
|
||||
deployment_user: users_res.singleRes,
|
||||
};
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -29,6 +29,10 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||
},
|
||||
);
|
||||
|
||||
if (!users_res.singleRes?.id) {
|
||||
return `/admin/users`;
|
||||
}
|
||||
|
||||
return {
|
||||
deployment_user: users_res.singleRes,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user