Skip to content

Commit

Permalink
reverse check order
Browse files Browse the repository at this point in the history
  • Loading branch information
Markusplay committed Jan 31, 2025
1 parent 6045ae5 commit d4dba94
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ const CoHMiddleware = async (request: NextRequest) => {
const user = await getUserDetails();
const hasAcceptedCoH = !!user?.codeOfHonorSignDate;

if (!hasAcceptedCoH && !isAcceptHonorPath(request)) {
return redirectWithIntl(request, '/accept-honor');
}

if ((!user?.studentProfile || hasAcceptedCoH) && isAcceptHonorPath(request)) {
return redirectWithIntl(request, '/');
}

if (!hasAcceptedCoH && !isAcceptHonorPath(request)) {
return redirectWithIntl(request, '/accept-honor');
}
} catch (error) {
return null;
}
Expand Down

0 comments on commit d4dba94

Please sign in to comment.