Skip to content

Commit

Permalink
fix: explicity end auth middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
warren-sadler committed Feb 10, 2023
1 parent b0fb770 commit 6dbac41
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/pages/api/auth/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default async function login(req: NextApiRequest, res: NextApiResponse) {
user: { ...session?.user, name: 'John Doe' },
});
await handleLogin(req, res);
res.end();
} catch (error) {
if (error instanceof LoginHandlerError) {
res.status(error.status ?? 400).end(error.message);
Expand Down
1 change: 1 addition & 0 deletions src/pages/api/auth/logout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { NextApiRequest, NextApiResponse } from 'next';
export default async function login(req: NextApiRequest, res: NextApiResponse) {
try {
await handleLogout(req, res);
res.end();
} catch (error) {
if (error instanceof LogoutHandlerError) {
res.status(error.status ?? 400).end(error.message);
Expand Down
1 change: 1 addition & 0 deletions src/pages/api/auth/me.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default async function callback(
) {
try {
await handleProfile(req, res);
res.end();
} catch (error) {
if (error instanceof ProfileHandlerError) {
res.status(error.status ?? 400).end(error.message);
Expand Down

1 comment on commit 6dbac41

@vercel
Copy link

@vercel vercel bot commented on 6dbac41 Feb 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.