Add user settings page
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import userAuth from "@/src/functions/backend/auth/user-auth";
|
||||
import grabUsers from "@/src/functions/backend/db/users/grab-users";
|
||||
import type { PagePropsType } from "@/src/types";
|
||||
import type { BunextPageServerFn } from "@moduletrace/bunext/types";
|
||||
|
||||
const server: BunextPageServerFn<PagePropsType> = async ({ req }) => {
|
||||
const { user } = await userAuth({ req });
|
||||
|
||||
if (!user?.logged_in_status || !user.id) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: "/auth/login",
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const user_res = await grabUsers({ user_id: user.id });
|
||||
|
||||
return {
|
||||
props: {
|
||||
single_user: user_res.singleRes || null,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default server;
|
||||
Reference in New Issue
Block a user