Merge branch 'main' into 766_admin_enhancement

This commit is contained in:
notmd
2023-01-20 23:12:43 +07:00
63 changed files with 874 additions and 225 deletions
+1
View File
@@ -4,6 +4,7 @@ import { useSession } from "next-auth/react";
import { useEffect } from "react";
import { getAdminLayout } from "src/components/Layout";
import { UserTable } from "src/components/UserTable";
export { getDefaultStaticProps as getStaticProps } from "src/lib/default_static_props";
/**
* Provides the admin index page that will display a list of users and give
+3 -1
View File
@@ -3,6 +3,7 @@ import { InferGetServerSidePropsType } from "next";
import Head from "next/head";
import { useRouter } from "next/router";
import { useSession } from "next-auth/react";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import { useEffect } from "react";
import { useForm } from "react-hook-form";
import { getAdminLayout } from "src/components/Layout";
@@ -111,7 +112,7 @@ const ManageUser = ({ user }: InferGetServerSidePropsType<typeof getServerSidePr
/**
* Fetch the user's data on the server side when rendering.
*/
export async function getServerSideProps({ query }) {
export async function getServerSideProps({ query, locale }) {
const backend_user = await oasstApiClient.fetch_user(query.id);
const local_user = await prisma.user.findUnique({
where: { id: backend_user.id },
@@ -126,6 +127,7 @@ export async function getServerSideProps({ query }) {
return {
props: {
user,
...(await serverSideTranslations(locale, ["common"])),
},
};
}