Update brewery post services, transactional emails

This commit is contained in:
Aaron William Po
2023-12-17 23:44:57 -05:00
parent bffa28b93d
commit db17a61f24
10 changed files with 106 additions and 63 deletions

View File

@@ -7,7 +7,7 @@ import { FC } from 'react';
import { z } from 'zod';
import withPageAuthRequired from '@/util/withPageAuthRequired';
import UserHeader from '@/components/UserPage/UserHeader';
import { findUserById } from '@/services/users/auth';
import { findUserByIdService } from '@/services/users/auth';
interface UserInfoPageProps {
user: z.infer<typeof GetUserSchema>;
@@ -40,7 +40,7 @@ export default UserInfoPage;
export const getServerSideProps = withPageAuthRequired<UserInfoPageProps>(
async (context) => {
const { id } = context.params!;
const user = await findUserById({ userId: id as string });
const user = await findUserByIdService({ userId: id as string });
return user
? { props: { user: JSON.parse(JSON.stringify(user)) } }
: { notFound: true };

View File

@@ -1,7 +1,7 @@
import { setLoginSession } from '@/config/auth/session';
import { verifyResetPasswordToken } from '@/config/jwt';
import ServerError from '@/config/util/ServerError';
import { findUserById } from '@/services/users/auth';
import { findUserByIdService } from '@/services/users/auth';
import { GetServerSideProps, NextApiResponse, NextPage } from 'next';
@@ -29,7 +29,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
const { id } = await verifyResetPasswordToken(token as string);
const user = await findUserById({ userId: id as string });
const user = await findUserByIdService({ userId: id as string });
if (!user) {
throw new ServerError('User not found', 404);
}