Skip to content

Commit

Permalink
feat: formated
Browse files Browse the repository at this point in the history
  • Loading branch information
TzuHanLiang committed Aug 15, 2024
1 parent 64173a5 commit da54f5f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ const findOrCreateUser = async ({
name: string;
email: string;
}) => {
// eslint-disable-next-line no-console
console.log('findOrCreateUser', provider, providerAccountId, name, email);
return {
id: '1',
hasReadAgreement: false,
Expand Down Expand Up @@ -118,7 +116,7 @@ export default NextAuth({
*/
let newToken = token;
if (account && user) {
// 查找或創建新用户(不更新已有用户)
// Info: (20240815-Tzuhan) 查找或創建新用户(不更新已有用户)
const dbUser = await findOrCreateUser({
provider: account.provider,
providerAccountId: account.providerAccountId,
Expand All @@ -133,8 +131,6 @@ export default NextAuth({
hasReadAgreement: dbUser.hasReadAgreement,
};
}
// eslint-disable-next-line no-console
console.log('jwt newToken', newToken);
return newToken;
},
async session({ session, token }) {
Expand Down
2 changes: 2 additions & 0 deletions src/pages/api/auth/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { NextApiRequest, NextApiResponse } from 'next';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
const { error } = req.query;
// Deprecate: (20240820-Tzuhan) dev
// eslint-disable-next-line no-console
console.error('Authentication error:', error);
return res.status(500).json({ message: `Authentication Error: ${error}` });
} catch (error) {
// Deprecate: (20240820-Tzuhan) dev
// eslint-disable-next-line no-console
console.error('Error in /api/auth/error:', error);
return res.status(500).json({ message: 'Internal Server Error' });
Expand Down
1 change: 1 addition & 0 deletions src/pages/users/login-beta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const getServerSideProps: GetServerSideProps = async ({ locale, query })
},
};
} catch (error) {
// Deprecate: (20240820-Tzuhan) dev
// eslint-disable-next-line no-console
console.error('Error in getServerSideProps:', error);

Expand Down
1 change: 1 addition & 0 deletions src/types/next-auth.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Info: (20240815-Tzuhan) not used but can not remove for custom modification next-auth session type
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import NextAuth from 'next-auth';

Expand Down

0 comments on commit da54f5f

Please sign in to comment.