Updates
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import Main from "@/src/components/pages/admin/users";
|
||||
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 AdminDashboard() {
|
||||
@@ -19,7 +21,15 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||
return `/admin`;
|
||||
}
|
||||
|
||||
return {};
|
||||
const users_res = await NSQLite.select<NSQLITE_TURBOCI_ADMIN_USERS>(
|
||||
{
|
||||
table: "users",
|
||||
},
|
||||
);
|
||||
|
||||
return {
|
||||
deployment_users: users_res.payload,
|
||||
};
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { NSQLITE_TEST_DB_USERS, NSQLiteTables } from "@/src/db/types";
|
||||
import { NSQLITE_TURBOCI_ADMIN_USERS, NSQLiteTables } from "@/src/db/types";
|
||||
import { APIReqObject } from "@/src/types";
|
||||
import loginUser from "@/src/functions/auth/login-user";
|
||||
import hashPassword from "@moduletrace/datasquirel/dist/package-shared/functions/dsql/hashPassword";
|
||||
@@ -29,7 +29,7 @@ export default async function handler(
|
||||
}
|
||||
|
||||
const existing_users_res = await NSQLite.select<
|
||||
NSQLITE_TEST_DB_USERS,
|
||||
NSQLITE_TURBOCI_ADMIN_USERS,
|
||||
(typeof NSQLiteTables)[number]
|
||||
>({
|
||||
table: "users",
|
||||
@@ -47,7 +47,7 @@ export default async function handler(
|
||||
const new_user_password = hashPassword({ password });
|
||||
|
||||
const new_user_insert_res = await NSQLite.insert<
|
||||
NSQLITE_TEST_DB_USERS,
|
||||
NSQLITE_TURBOCI_ADMIN_USERS,
|
||||
(typeof NSQLiteTables)[number]
|
||||
>({
|
||||
data: [
|
||||
@@ -71,7 +71,7 @@ export default async function handler(
|
||||
}
|
||||
|
||||
const newly_inserted_user_res = await NSQLite.select<
|
||||
NSQLITE_TEST_DB_USERS,
|
||||
NSQLITE_TURBOCI_ADMIN_USERS,
|
||||
(typeof NSQLiteTables)[number]
|
||||
>({
|
||||
table: "users",
|
||||
|
||||
@@ -16,7 +16,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||
|
||||
return {
|
||||
redirect: {
|
||||
destination: `/login`,
|
||||
destination: `/auth/login`,
|
||||
statusCode: 307,
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user