Skip to content

Commit

Permalink
Fix typescript errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredpalmer committed Nov 5, 2024
1 parent 1719149 commit 4880e0d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions app/(auth)/auth.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { NextAuthConfig } from "next-auth";
import { NextAuthConfig } from 'next-auth';

export const authConfig = {
pages: {
signIn: "/login",
newUser: "/",
signIn: '/login',
newUser: '/',
},
providers: [
// added later in auth.ts since it requires bcrypt which is only compatible with Node.js
Expand All @@ -12,12 +12,12 @@ export const authConfig = {
callbacks: {
authorized({ auth, request: { nextUrl } }) {
let isLoggedIn = !!auth?.user;
let isOnChat = nextUrl.pathname.startsWith("/");
let isOnRegister = nextUrl.pathname.startsWith("/register");
let isOnLogin = nextUrl.pathname.startsWith("/login");
let isOnChat = nextUrl.pathname.startsWith('/');
let isOnRegister = nextUrl.pathname.startsWith('/register');
let isOnLogin = nextUrl.pathname.startsWith('/login');

if (isLoggedIn && (isOnLogin || isOnRegister)) {
return Response.redirect(new URL("/", nextUrl));
return Response.redirect(new URL('/', nextUrl as unknown as URL));
}

if (isOnRegister || isOnLogin) {
Expand All @@ -30,7 +30,7 @@ export const authConfig = {
}

if (isLoggedIn) {
return Response.redirect(new URL("/", nextUrl));
return Response.redirect(new URL('/', nextUrl as unknown as URL));
}

return true;
Expand Down

0 comments on commit 4880e0d

Please sign in to comment.