Skip to content

Commit 66000f8

Browse files
committed
Address review comments
1 parent 0630dbb commit 66000f8

File tree

2 files changed

+3
-23
lines changed

2 files changed

+3
-23
lines changed

src/middleware.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ export default async function middleware(req: NextRequest) {
1919

2020
// 3. Get the session from the cookie
2121
const sessionCookie = req.cookies.get("id");
22-
const validSession = sessionCookie?.value;
22+
const isValidSession = sessionCookie?.value;
2323

2424
// 4. Redirect to / if the user is not authenticated
2525
// 4b. TODO: Check session validity/expiration?
26-
if (isProtectedRoute && !validSession) {
26+
if (isProtectedRoute && !isValidSession) {
2727
return NextResponse.redirect(new URL("/", req.nextUrl));
2828
}
2929

3030
// 5. Redirect to /dashboard if the user is authenticated
3131
if (
3232
isPublicRoute &&
33-
validSession &&
33+
isValidSession &&
3434
!req.nextUrl.pathname.startsWith("/dashboard")
3535
) {
3636
return NextResponse.redirect(new URL("/dashboard", req.nextUrl));

src/types/coaching-session.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,26 +69,6 @@ export function filterAndSortCoachingSessions(
6969
return filteredSessions;
7070
}
7171

72-
// export function sortCoachingSessionArray(
73-
// sessions: CoachingSession[],
74-
// order: SortOrder
75-
// ): CoachingSession[] {
76-
// if (order == SortOrder.Ascending) {
77-
// sessions.sort(
78-
// (a, b) =>
79-
// new Date(a.date.toString()).getTime() -
80-
// new Date(b.date.toString()).getTime()
81-
// );
82-
// } else if (order == SortOrder.Descending) {
83-
// sessions.sort(
84-
// (a, b) =>
85-
// new Date(b.date.toString()).getTime() -
86-
// new Date(a.date.toString()).getTime()
87-
// );
88-
// }
89-
// return sessions;
90-
// }
91-
9272
export function getCoachingSessionById(
9373
id: string,
9474
sessions: CoachingSession[]

0 commit comments

Comments
 (0)