zapishis-client/apps/web/middleware.ts
vchikalkin 17ce24ae04 fix(auth): handle unregistered users in authentication flow
- Updated the authentication logic in both Auth and useAuth functions to redirect unregistered users to the '/unregistered' page.
- Enhanced error handling in the authOptions to check for user registration status using the Telegram ID.
- Improved the matcher configuration in middleware to exclude the '/unregistered' route from authentication checks.
2025-09-10 18:27:31 +03:00

16 lines
326 B
TypeScript

// middleware.ts
import { withAuth } from 'next-auth/middleware';
export default withAuth({
callbacks: {
authorized: ({ token }) => Boolean(token),
},
pages: {
signIn: '/',
},
});
export const config = {
matcher: ['/((?!auth|browser|telegram|unregistered|api|_next/static|_next/image|favicon.ico).*)'],
};