Updates
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import Main from "@/src/components/pages/admin/users";
|
||||
import defaultAdminProps from "@/src/functions/pages/admin/default-admin-props";
|
||||
import Layout from "@/src/layouts/admin";
|
||||
import { GetServerSideProps } from "next";
|
||||
|
||||
export default function AdminDashboard() {
|
||||
return (
|
||||
<Layout>
|
||||
<Main />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||
return await defaultAdminProps({
|
||||
ctx,
|
||||
async propsFn({ user, props }) {
|
||||
if (!user.super_admin) {
|
||||
return `/admin`;
|
||||
}
|
||||
|
||||
return {};
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
import { APIReqObject } from "@/src/types";
|
||||
import loginUser from "@/src/utils/login-user";
|
||||
import loginUser from "@/src/functions/auth/login-user";
|
||||
import { APIResponseObject } from "@moduletrace/datasquirel/dist/package-shared/types";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { NSQLITE_TEST_DB_USERS, NSQLiteTables } from "@/src/db/types";
|
||||
import { APIReqObject } from "@/src/types";
|
||||
import loginUser from "@/src/utils/login-user";
|
||||
import loginUser from "@/src/functions/auth/login-user";
|
||||
import hashPassword from "@moduletrace/datasquirel/dist/package-shared/functions/dsql/hashPassword";
|
||||
import { APIResponseObject } from "@moduletrace/datasquirel/dist/package-shared/types";
|
||||
import NSQLite from "@moduletrace/nsqlite";
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import logoutUser from "@/src/functions/auth/logout-user";
|
||||
import Layout from "@/src/layouts/login";
|
||||
import H2 from "@/twui/components/layout/H2";
|
||||
import { GetServerSideProps } from "next";
|
||||
|
||||
export default function LogoutPage() {
|
||||
return (
|
||||
<Layout>
|
||||
<H2>Loging out ...</H2>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||
await logoutUser({ res: ctx.res });
|
||||
|
||||
return {
|
||||
redirect: {
|
||||
destination: `/login`,
|
||||
statusCode: 307,
|
||||
},
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user